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

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -