angular controller的使用
在angular.js最常用的模块就是控制器了,通常我们会这样使用:
var myAppModule = angular.module('myApp', []);
myAppModule.controller('TextController',
function($scope,$http) {
} );
这样就定义了一个新的控制器TextController,个人觉得不太习惯使用这种用法,我们 可以这样:
var TextController=function($scope){
$scope.d="ddd";
}
实现相同功能!