我在角頁上。 第1頁: 在哪個配置是如何在ajax中呈現角模板
.when('/Test/:empId', {
templateUrl:'/Templates/test.html',
controller: 'TestController'
})
.when('/Test/:depId', {
templateUrl:'/Templates/test1.html',
controller: 'Test1Controller'
})
然後我有另一頁
第2頁: 這頁具有正常MVC剃刀頁按鈕
Button1
在該按鈕的點擊我想要顯示的模態,其中包含 Page1
所以我寫了
$.ajax({
url: '/Templates/test.html',
type: 'GET',
success: function (responce) {
var elem = angular.element(responce);
$('#testModalBody').html(elem);
$('#testModal').modal('show');
//console.log('test responce');
}
});
我剛開的HTML響應,它不執行「的TestController」 所以變量的作用域沒有得到在聲明的TestController能夠看到數據的HTML頁面的值,而不是。只要看看靜態html模板。
嘗試使用'$編譯(angular.element()($範圍))' –
@JayantPatil:讓angular.element(...)不是一個函數錯誤 –