0
我正在使用非Angular移動響應框架,我正在嘗試將AngularJS數據綁定與它集成。
任何新添加到DOM的內容(添加到Angular之外)都不在Angular的範圍內,並且我無法解決如何將它添加到範圍中。
這是我到目前爲止有:
//non angularJS javascript here...
var app = framework({
....,
preprocess: function (content, url) {
//content variable is the content to be added to the DOM. eg "<div ng-bind...>......</div>"
//need to use Angular here to add this new "content" to Angular's scope.
return content; //need to return the content so that is gets added to DOM
});
....
});
我將如何添加角到這個預處理功能,將它添加到DOM之前,編制了「內容」?
感謝
謝謝......這個實例中的「#yourController」是什麼,因爲我沒有使用Angular控制器將這個內容添加到DOM?它是否包含新的「內容」將被插入到的HTML元素? – Martin
而且,在此階段(預處理),內容尚未添加到DOM。它在變量「content」preprocess:function(content,url){'所以我們需要在它被Angular編譯後返回它,所以框架可以將它添加到DOM。 – Martin
這是你的div元素,你定義了你的ng-controller屬性,你的範圍被應用。我不確定在使用角度時是否有辦法不使用控制器? – Burhan