[英]Angular unknown provider error
I am having an issue with angular and yeoman when running grunt serve which minifies and outputs my angular app to my dist directory for production. 我在运行grunt服务时遇到角度和自耕农的问题,这会缩小并输出我的角度应用程序到我的dist目录进行生产。 When running my app in my local host everything seems to work fine but after doing a build something is happening that is not clear to me at the moment.
在我的本地主机上运行我的应用程序时,一切似乎都运行良好,但在进行构建之后发生了一些事情,目前我还不清楚。 Any help would be greatly appreciated.
任何帮助将不胜感激。
This is the controller that I introduced to my project that is causing the issue: 这是我向我的项目引入的导致问题的控制器:
var myPlayer
angular.module('myapp')
.controller('ShowCaseTabCtrl', function ($scope) {
$scope.tabs = [
{
title:"Video",
content:'templates/showcased-video.html',
},
{
title:"Gallery",
content:'templates/showcased-gallery.html',
}
];
// here I am firing this method on ng-include onload to ensure video js
// is being properly instantiated
$scope.initVideo = function() {
videojs('showcase-video', {
'controls': true,
'autoplay': false,
'preload': 'auto',
'poster': 'images/posters/poster.jpg'
}, function(){
myPlayer = this;
myPlayer.dimensions(900, 600);
myPlayer.poster('images/posters/poster.jpg');
myPlayer.src([
{ type: 'video/mp4', src: 'video/myvideo.mp4' },
{ type: 'video/ogg', src: 'video/myvideo.ogv' }
]);
});
}
});
This my view of the controller above: 这是我对上面控制器的看法:
<section ng-controller="ShowCaseTabCtrl">
<div class="mod-wrap full-bleed">
<tabset>
<tab ng-repeat="tab in tabs" heading="{{tab.title}}" content="{{tab.content}}" active="tab.active">
<ng-include src="tab.content" onload="initVideo()"></ng-include>
</tab>
</tabset>
</div>
Error I am getting after running grunt serve from yo-angular generator: 从yo-angular生成器运行grunt服务后我遇到错误:
Error: [$injector:unpr] Unknown provider: aProvider <- a
The cause is probably the minification of your js files. 原因可能是你的js文件的缩小。
Try the array notation in declaring your controllers, services and filters. 在声明控制器,服务和过滤器时尝试使用数组表示法。
eg 例如
controller('ShowCaseTabCtrl', ['$scope', function ($scope) {
// Your code here
}]);
The reference is in the 5th step of the Angular Phonecat tutorial. 该参考文献是Angular Phonecat教程的第5步 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.