【发布时间】:2014-08-26 01:56:40
【问题描述】:
我在运行 grunt serve 时遇到了 angular 和 yeoman 的问题,它会缩小我的 angular 应用程序并将其输出到我的 dist 目录以进行生产。在我的本地主机上运行我的应用程序时,一切似乎都运行良好,但是在构建之后发生了一些事情,目前我还不清楚。任何帮助将不胜感激。
这是我在项目中引入的导致问题的控制器:
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' }
]);
});
}
});
这是我对上面控制器的看法:
<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>
从 yo-angular 生成器运行 grunt serve 后出现的错误:
Error: [$injector:unpr] Unknown provider: aProvider <- a
【问题讨论】:
-
您是否在 js 文件中应用了缩小?
标签: javascript angularjs yeoman