angularjs - Should I declare "var" variables in an Angular controller or always use $scope -


if have controller such as:

myapp.controller('newcontroller', function ($scope, $window) {    var x = 5;    $scope.y = 5; }); 

and x , y going changed application, make difference whether or not declare var x on $scope or declare var right now?

$scope glue between rendered view , controller. if don't need variable in view, don't add $scope object.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -