•  单个参数调用angular.module(),用来取得该模块而不是定义新的

这样就可以在不同的地方定义app的controller而不用通过全局变量


angular.module('myapp')
.controller('xxController',function(){});

 


 

    •  在controller中的document ready事件下运行代码

angular.module('myapp')
.controller('MyCtrl',
function MyCtrl($scope) { angular.element(document).ready(function () { console.log('Hello ,document is ready!'); }); });

 

相关文章:

  • 2021-08-13
  • 2022-01-19
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-03-11
  • 2021-10-01
猜你喜欢
  • 2021-08-26
  • 2021-10-26
  • 2021-11-20
  • 2021-08-20
  • 2022-01-24
  • 2022-12-23
相关资源
相似解决方案