0
我已经有一个指令(appView),并且有一些html可以通过templateUrl加载。到目前为止,我需要向另一个指令(appView)正在使用的模板添加一个自定义指令。如何将自定义指令包含在角度js中的另一个自定义指令的模板(html)
请参阅下面的代码,它不按预期工作。有关这方面的任何帮助,我可以如何让这项工作?
View.html(模板)
<div>
<div class="dragdrop" id="dropzone" dropzone> //here is my custom directive
<div class="fileUpload btn btn-primary">
<span>UPLOAD ASSETS</span>
<input id="dzFile" type="file" class="upload" />
</div>
</div>
</div>
角JS
var appModule = angular.module("Newapp", []);
appModule.directive("appView", appView);
function appView(){
var directive = {
restrict: 'E',
templateUrl: 'app/View.html'
};
return directive;
}
appModule.directive("dropzone", function(){ //This is added to the View.html as attribute(see above html code with **)
var directive = {
restrict: 'A',
link: FullDragDrop
};
return directive;
});
function FullDragDrop(){
console.log("soemthing goes here");
}
我怎样才能使这个可能,请?
为什么** **悬浮窗,而不是你的悬浮窗里面View.html? – Nicolas2bert
@NicolasHumbert,这是通知谁引用,多数民众赞成它。它只是dropzone – User123
@ User123你在找什么?你的代码正在工作。你可以检查一下这个笨蛋,看看。显示文字“这里有东西”。 http://plnkr.co/edit/vwIrM7D402juEDDHDKbC?p=preview –