Please enable JavaScript.
Coggle requires JavaScript to display documents.
AngularJS (Apps: myApp = angular.module('myApp', [dependencies...]…
AngularJS
Apps: myApp = angular.module('myApp', [dependencies...], function() {});
Add ng-app attribute to html element.
Views
-
-
-
Custom Directives myApp.directive("searchResult", function() {}
{ templateUrl: 'templates/xx', replace: true }
-
-
-
-
compile: function(elem, attrs) {}; gives ability to alter elements and attributes when the template is first 'compiled'
-
-
Model
Controllers: myApp
.controller('myController', ['$scope', '$log', function($scope, $log) {}];
Add ng-controller attribute to html element.
Angular services (mostly singletons, $scope is an exception)
-
-
-
-
-
-
-
-
Custom Services: myApp.service('myService', function() { this.x = 'a'});
-
-
To use a variable/function outside of Angular ecosystem, use $scope.apply(function() {}); so that any changes flow to digest loop