- Build SPA application
- MVVM mode
- Created by Misko Hevery in 2009
- Open source , supported by Goggle
- lib link
- auto init --- use ng-app directive
- init by manual -- angular.bootstrap(document, ['moduleName']);
- notes -- ng-app and angular.bootstrap can't be used together.
- ng-mode + {{}} expressions or ng-mode + ng-bind
- one-time binding {{:: message}}
- two way binding {{ message }}
-
register controller with angular module angular.module('moduleName', []).controller('controllerName', function() {});
-
$scope
angular.module('moduleName',[]).controller('appController', function($scope) { $scope.message = "***"; });
{{ message }} -
controller as syntax after version 1.2
ng-controller = "appController as ctrl"
angular.module('app', []).controller('appController', function() { var ctrl = this; //important });