[英]Getting AngularJS multilink error after upgrade from v. 1.4
我有一個帶有子指令的大指令,在這里我得到了錯誤。 的確,它在主指令的link
函數中調用transcludeFn()
時在步驟上發生:
var link = function ($scope, elem, attr, parentCtrl, transcludeFn) {
// Run all nested directives in order to properly register columns in grid.
transcludeFn();
// Add compiled content to directive element.
elem.after($compile(template)($scope));
};
無法解決該問題。 我在文檔中錯過了什么? $onInit
所述,使用$onInit
添加內容沒有幫助( 我不確定我是否正確執行了此操作 )。
我對AngularJS不熟悉,因此任何幫助都將是一個不錯的選擇。
我真的不知道問題的根源是什么,但是我已經通過將虛擬函數傳遞給transcludeFn()
解決了這個問題:
var link = function ($scope, elem, attr, parentCtrl, transcludeFn) {
// Run all nested directives in order to properly register columns in grid.
transcludeFn();
transcludeFn(function() {
// do nothing, only for fixing upgrade issue
});
// Add compiled content to directive element.
elem.after($compile(template)($scope));
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.