0
angular.module('app.services', []).service("test", function($http, $rootScope){
this.test=function(){
$rootScope.name="test1";
};
};
angular.module('app.controllers', []).controller('TestController', function ($scope, test) {
test.send();
})
我没有得到一个错误,但这些更改没有应用到UI。我试过$ scope.apply()并出现错误。从服务更新角度模型
感谢还是调用$ rootScope.name = “测试1”;不更新ui – nullException
你有没有看到我贴的小提琴?请发布您的HTML代码 –