Angular.js 指令 & Controller
来源:互联网 发布:淘宝天刀代购会被骗么 编辑:程序博客网 时间:2024/05/16 18:33
<!doctype html><html ng-app="myapp"> <head> <script src="angular.min.js"></script><script> var app = angular.module('myapp',[]); app.directive('helloWorld',function(){return { //scope: true, //使用一个继承父作用域的自作用域 restrict: 'E',replace: true,template: '<h3 style="background-color:{{name}}">Hello World!</h3>',link: function(scope,elem,attr){elem.bind('click',function(){scope.$apply(function(){scope.name="red"});});elem.bind('mouseover',function(){elem.css('cursor','pointer');});}}}); //controllerfunction PhoneListCtrl($scope) { $scope.phones = [{"name": "Nexus S", "snippet": "Fast just got faster with Nexus S."},{"name": "Motorola XOOM? with Wi-Fi", "snippet": "The Next, Next Generation tablet."},{"name": "MOTOROLA XOOM?", "snippet": "The Next, Next Generation tablet."} ]; $scope.name="sunjian" }</script> </head> <body ng-controller="PhoneListCtrl"> <input ng-model="name"> <ul><li ng-repeat="phone in phones" ng-dragstart="dragStart()"> {{phone.name+' '+name}} <p>{{phone.snippet}}</p></li></ul><hr/><hello-world></hello-world> <div hello-world></div> </body></html>
0 0
- Angular.js 指令 & Controller
- [angular]指令之5controller
- 什么是angular js指令
- 创建angular js指令
- angular js自定义指令
- angular js指令详解
- Angular.js指令
- angular.js自定义指令
- angular.js指令(directive)中的controller,compile,link函数有什么不同?
- Angular Js ng-repeat指令
- Angular js指令收录(五)
- Angular js指令收录(六)
- angular.js常用内置指令
- 关于angular中controller和指令交互数据:@
- angular js指令(directives)及其例子
- 《Angular JS 权威教程》 - 内置指令
- angular.js基础(1)--指令directive
- angular.js(3)--指令的执行过程
- 基于Selenium2与Python自动化测试环境搭建
- Linux内核中的Cache段
- 使用不同的项目宏决定载入不同资源
- Android有效加载图片 之 有效加载大图片
- Java中的Enum的使用与分析
- Angular.js 指令 & Controller
- php新增Stomp模块
- OpenCV求取轮廓线
- 7种形式的Android Dialog使用举例
- 工作中遇到的异常处理
- Oracle-Merge
- Android 内存溢出解决方案(OOM) 整理总结
- Sqoop详细介绍包括:sqoop命令,原理,流程
- HDOJ 4815 Little Tiger vs. Deep Monkey