手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >AngularJS实现根据变量改变动态加载模板的方法
AngularJS实现根据变量改变动态加载模板的方法
摘要:本文实例讲述了AngularJS实现根据变量改变动态加载模板的方法。分享给大家供大家参考,具体如下:directive:return{res...

本文实例讲述了AngularJS实现根据变量改变动态加载模板的方法。分享给大家供大家参考,具体如下:

directive:

return { restrict: 'E', replace: true, templateUrl: 'app/view/order.html', link: function (scope, element, attrs) { scope.Type = attrs.Type; } };

模板:

<div ng-switch on="item.Type"> <div ng-switch-when="1"><ng-include src="'views/1.html'"></ng-include></div> <div ng-switch-when="2"><ng-include src="'views/2.html'"></ng-include></div> <div ng-switch-when="3"><ng-include src="'views/3.html'"></ng-include></div> </div>

希望本文所述对大家AngularJS程序设计有所帮助。

【AngularJS实现根据变量改变动态加载模板的方法】相关文章:

javascript实现图片跟随鼠标移动效果的方法

jQuery实现转动随机数抽奖效果的方法

javascript实现Table排序的方法

创建你的第一个AngularJS应用的方法

jQuery处理图片加载失败的常用方法

javascript实现可全选、反选及删除表格的方法

AngularJS身份验证的方法

动态加载jQuery的方法

javascript实现动态改变层大小的方法

JavaScript实现弹出模态窗体并接受传值的方法

精品推荐
分类导航