Tutorial by Examples

As defined in the AngularJS Documentation When a Controller is attached to the DOM via the ng-controller directive, Angular will instantiate a new Controller object, using the specified Controller's constructor function. A new child scope will be created and made available as an injectable par...
The Controller we have made can be instantiated and used using controller as Syntax. That's because we have put variable directly on the controller class and not on the $scope. Using controller as someName is to seperate the controller from $scope itself.So, there is no need of injecting $scope as ...
The way the $scope is injected in the controller's constructor functions is a way to demonstrate and use the basic option of angular dependency injection but is not production ready as it cannot be minified. Thats because the minification system changes the variable names and anguar's dependency i...
Controller Function Controller function is nothing but just a JavaScript constructor function. Hence, when a view loads the function context(this) is set to the controller object. Case 1 : this.constFunction = function() { ... } It is created in the controller object, not on $scope. views can ...

Page 1 of 1