【发布时间】:2017-10-25 17:13:44
【问题描述】:
我在有角度的页面上。 第 1 页: 在哪个配置中
.when('/Test/:empId', {
templateUrl:'/Templates/test.html',
controller: 'TestController'
})
.when('/Test/:depId', {
templateUrl:'/Templates/test1.html',
controller: 'Test1Controller'
})
然后我有另一个页面
第 2 页: 此页面是带有按钮的普通 mvc razor 页面
Button1
单击该按钮时,我想显示包含的模式 第1页
所以我写了
$.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 模板。
【问题讨论】:
-
尝试使用
$compile(angular.element()($scope)) -
@JayantPatil : 获取 angular.element(...) 不是函数错误
标签: angularjs asp.net-mvc angularjs-directive angular-ui-router