Angularjs 在anuglar服务中使用角度ui通知而不是控制器?
我能够在控制器中使用上述模块,语法如下,但尝试在服务中使用相同的模块时,该模块不起作用Angularjs 在anuglar服务中使用角度ui通知而不是控制器?,angularjs,angularjs-scope,angularjs-module,Angularjs,Angularjs Scope,Angularjs Module,我能够在控制器中使用上述模块,语法如下,但尝试在服务中使用相同的模块时,该模块不起作用 app.controller('regulationCtrl', function ($scope, $rootScope, $http, $window, $location,Notification) { Notification.primary({message: "Some error message", templateUrl: "custom_template.html",
app.controller('regulationCtrl', function ($scope, $rootScope, $http, $window, $location,Notification) {
Notification.primary({message: "Some error message", templateUrl: "custom_template.html", scope: $scope});
//THIS CODE WORKS FINE
});
app.service('fileUploadRegulations', function ($http,Notification, $rootScope) {
this.uploadFileToUrl = function (file, country, juridiction, uploadUrl,Notification) {
Notification.primary({message: "Some error msg:", templateUrl: "custom_template.html", scope: $scope});
//THIS CODE NOT WORKING
}
});
插件官方URL:您不应该显示来自服务的UI通知。您可以使用回调或事件通知控件“发生了什么事”(在您的情况下,它似乎是文件上载)。然后UI控制器将显示通知弹出窗口