angularjs怎样在对应页面引入对应外部js
答案:1 悬赏:40
解决时间 2021-02-11 15:35
- 提问者网友:星空下的寂寞
- 2021-02-10 19:00
angularjs怎样在对应页面引入对应外部js
最佳答案
- 二级知识专家网友:瘾与深巷
- 2021-02-10 20:14
你可以查查angularjs搜依赖注入我贴个例子//defineamodulevarmainApp=angular.module("mainApp",[]);//createaservicewhichdefinesamethodsquaretoreturnsquareofanumber.mainApp.service('CalcService',function(MathService){this.square=function(a){returnMathService.multiply(a,a);}});//injecttheservice"CalcService"intothecontrollermainApp.controller('CalcController',function($scope,CalcService,defaultInput){$scope.number=defaultInput;$scope.result=CalcService.square($scope.number);$scope.square=function(){$scope.result=CalcService.square($scope.number);}});就是这样调用service的
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯