NG-包括与SRC变量 [英] ng-include with a variable for src
本文介绍了NG-包括与SRC变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想改变NG-包括具有可变SRC。目前,这就是我。
I would like to change the ng-includes src with a variable. Currently this is what I have.
<div class='alignRightCenter' id='rightContent'>
<ng-include src="'{{view}}'"> </ng-include>
</div>
而这里是控制器:
And here is the controller:
ctrl.controller('contentCtrl', ['$scope', function($scope) {
$scope.view = "partials/setListName.tpl.html";
}]);
不幸的是我不能使用NG-视图,因为它已经被用来让我这个页面。
是否有可能作出这样的工作?
Unfortunately I can not use a ng-view because it is already being used to get me to this page. Is it possible to make something like this work?
推荐答案
尝试如下:
<ng-include src="view"> </ng-include>
-----------------或----------------------
-----------------OR----------------------
您可以做到这一点的方式,
You can do this way,
查看:
<div data-ng-include data-ng-src="getPartial()"></div>
控制器:
function AppCtrl ($scope) {
$scope.getPartial = function () {
return 'partials/issues.html';
}
}
这篇关于NG-包括与SRC变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文