嗨,我想使用角js的烤面包通知。
这个:https://github.com/Foxandxss/angular-toastr
我有我的控制器和我的索引,在mi索引y中导入所有css和js来使用我的应用程序,但是当我尝试在我的控制器中插入我的toastr脚本时,控制台显示了这个错误
未知提供者: toastrProvider <- toastr <- clientController
我的索引:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="angular/angular-toastr/dist/angular-toastr.min.css" />
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="angular/angular.min.js"></script>
<script src="angular/angular-route/angular-route.min.js"></script>
<script src="angular/angular-toastr/dist/angular-toastr.min.js"></script>
<!-- <script src="resources/angular/angular-toastr/dist/angular-toastr.tpls.js"></script> also try -->
</head>
<body ng-app="app">
<li><a href="#!client">new client</li>
<div class="container">
<div ng-view></div>
</div>
<script src="app/runConfig.js"></script>
<script src="app/controllers/client.conroller.js"></script>
</body>
</html>我的控制器:
(function () {
'use stritct';
angular
.module('app')
.controller('clientController', clientController);
clientController.inject = ['$rootScope', '$scope', '$location', 'toastr'];
function clientController($rootScope, $scope, $location, toastr) {
}
})();发布于 2018-02-14 21:55:30
您就快到了,您错过了将toastr服务注入应用程序模块。这如github上的设置所示。
angular.module('app', ['toastr'])
https://stackoverflow.com/questions/48795805
复制相似问题