[AngularJS] How to create Directives?
来源:互联网 发布:淘宝代付有限额吗 编辑:程序博客网 时间:2024/06/06 11:38
Directives are the reusable UI components in AngularJS. In this blog, i will show you how to create custom directives in AngularJS.
var app = angular.module('App', []);app.directive('hi', function() { return { template: '<h2>Hi There</h2>', replace: true };});app.directive('hello', function() { return { template: '<h2>Hello There</h2>', replace: true };});app.directive('customDirective', function($compile) { return { template: '<a ng-click="addType(\'hi\')">Add Hi</a><br/><a ng-click="addType(\'hello\')">Add Hello</a><div class="holder">', link: function(scope, element, attr) { scope.addType = function(type) { var el = $compile('<div ' + type + '></div>')(scope); $('.holder', element).append(el); } } };});
0 0
- [AngularJS] How to create Directives?
- angularJs directives
- How to create singleton
- How to create alarm
- How to create WCF
- How to Create Tables
- Siebel HOW TO: How to create Products?
- AngularJS directives实践(一)
- Angularjs指令directives
- How to Create a Customer
- How to create Firefox extensions
- How to create new geodatabases
- how to create cifs.ko
- How to create EPS files...
- How to create PFX file
- how to create a Makefile
- How to create recovery image
- how to create proxies pool
- paip.java c++得到当前类,方法名称以及行号
- Android精美登录界面设计
- paip 自定义输入法多多输入法词库的备份导出以及导入
- 一个人在陌生的城市里,我依然很想你
- 拷问Unity:开发U3D游戏要思考的问题
- [AngularJS] How to create Directives?
- 用java计算文件MD5(文件hash)
- 自定义Button样式
- BSD各版本发展史
- android 自定义按钮样式
- FreeBSD历史
- Linux网络编程之循环服务器(转)
- 简单实现Android实现九宫格
- 收藏关于Linux IPC的一个系列的文章