本文主要和大家分享angularjs模块化技术详解,希望能帮助到大家。
1、directive 指令
<span style="font-size: 14px;"><!doctype html><html><head><meta charset="utf-8"><script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script><br/> <script><br/> var app = angular.module('test',[]);<br/> app.controller('con1',function($scope){<br/> $scope.arr = ['app','abc','beer','clear'];<br/> });<br/> app.directive('abc',function(){<br/> alert("执行了directive") return {<br/> restrict:'e',<br/> template: '<input type="text" ng-model="str"/>\<br/> <ul>\<br/> <li ng-repeat="v in arr" ng-show="v.indexof(str)!=-1">{{v}}</li>\<br/> <ul>'<br/> }<br/> }) </script><br/> </head><body><br/> <p ng-app="test" ng-controller="con1"><br/> <abc></abc><br/> </p></body></html><br/></span>2、模块化(重用)
1)按需加载、动态加载
2)封装、隔离
1、directive 指令
<span style="font-size: 14px;"><!doctype html><html><head><meta charset="utf-8"><script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script><br/> <script><br/> var app = angular.module('test',[]);<br/> app.controller('con1',function($scope){<br/> $scope.arr = ['app','abc','beer','clear'];<br/> });<br/> app.directive('abc',function(){<br/> alert("执行了directive") return {<br/> restrict:'e',<br/> template: '<input type="text" ng-model="str"/>\<br/> <ul>\<br/> <li ng-repeat="v in arr" ng-show="v.indexof(str)!=-1">{{v}}</li>\<br/> <ul>'<br/> }<br/> }) </script><br/> </head><body><br/> <p ng-app="test" ng-controller="con1"><br/> <abc></abc><br/> </p></body></html><br/></span>2、模块化(重用)
1)按需加载、动态加载
2)封装、隔离
相关推荐:
AngularJS模块学习之Anchor Scroll_AngularJS
95Shop可以免费下载使用,是一款仿醉品商城网店系统,内置SEO优化,具有模块丰富、管理简洁直观,操作易用等特点,系统功能完整,运行速度较快,采用ASP.NET(C#)技术开发,配合SQL Serve2000数据库存储数据,运行环境为微软ASP.NET 2.0。95Shop官方网站定期开发新功能和维护升级。可以放心使用! 安装运行方法 1、下载软件压缩包; 2、将下载的软件压缩包解压缩,得到we









