【发布时间】:2014-06-04 19:01:21
【问题描述】:
情况是这样的。我有一个指令,它依赖于一个 templateUrl。
指令看起来像这样:
angular.module('foo')
.directive('bar', function(){
return {
restrict: 'E',
replace: true,
templateUrl: '/foo/bar.html',
controller: 'fooController',
require: '^ngModel',
scope: {
onSuccess: '&'
}
};
});
此指令是我的一个应用程序的一部分,重要的是它始终是应用程序的一部分。但是,我也想在其他项目中使用相同的指令,目前我正在使用 bower 将存储库下拉到我的其他项目中。但是,该指令将中断,因为 templateUrl 不正确。 Bower 克隆了我的整个项目,模板的实际路径充其量在我的其他项目中需要是这样的:
/lib/public/foo/bar.html
其他人如何管理这个?
【问题讨论】: