[AngularJS] New in Angular 1.3 - bindToController
If you want to use controllers, instead of a link function, you can use bindToController.
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>Egghead.io Tutorials</title>
<style>body{padding:20px}</style>
<link rel="shortcut icon" href="favicon.ico">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.3/angular.js"></script>
<script src="app.js"></script>
</head>
<body> <note message="hello"></note>
</body>
</html>
angular.module("app", [])
.directive("note", function note() {
return {
scope: {
message: "@" //pass in a string
},
bindToController: true,
controller: "NoteCtrl as note",
template: "<div>{{note.message}}</div>"
};
})
.controller("NoteCtrl", function NoteCtrl() {
var note = this;
});

[AngularJS] New in Angular 1.3 - bindToController的更多相关文章
- [Angular] Use Angular components in AngularJS applications with Angular Elements
When migrating AngularJS (v1.x) applications to Angular you have different options. Using Angular El ...
- 【js类库AngularJs】解决angular+springmvc的post提交问题
[js类库AngularJs]解决angular+springmvc的post提交问题 AngularJS诞生于2009年,由Misko Hevery 等人创建,后为Google所收购.是一款优秀的前 ...
- [AngularJS] New in Angular 1.3 - Performance Boost with debugInfoEnabled
By default, Angular provides a lot of debug information on the DOM that's only necessary for tools l ...
- [AngularJS] Lazy loading Angular modules with ocLazyLoad
With the ocLazyLoad you can load AngularJS modules on demand. This is very handy for runtime loading ...
- [AngularJS - thoughtram] Exploring Angular 1.3: Binding to Directive Controllers
The post we have: http://www.cnblogs.com/Answer1215/p/4185504.html gives a breif introduce about bin ...
- [AngularJS] Exploring the Angular 1.5 .component() method
Angualr 1.4: .directive('counter', function counter() { return { scope: {}, restrict: 'EA', transclu ...
- [AngularJS] New in Angular 1.5 ng-animate-swap
<!DOCTYPE html> <html ng-app="MyApplication"> <head> <link rel=" ...
- AngularJS进阶(五)Angular实现下拉菜单多选
Angular实现下拉菜单多选 写这篇文章时,引用文章地址如下: http://ngmodules.org/modules/angularjs-dropdown-multiselect http:// ...
- AngularJS进阶(四)ANGULAR.JS实现下拉菜单单选
ANGULAR.JS: NG-SELECT AND NG-OPTIONS PS:其实看英文文档比看中文文档更容易理解,前提是你的英语基础还可以.英文文档对于知识点讲述简明扼要,通俗易懂,而有些中文文档 ...
随机推荐
- WPF如何在同一个区域依次叠加显示多张图片呢?
正如标题的问题,有时需要在已显示的图片的右上角(或其他区域)显示小图标,譬如下图的患者头像右上角显示病情图标:(这里不采用事先用PS编排成一个图片文件的方式,因为此方式普适性不好) 解决方案:绘制该复 ...
- POJ 1068 Parencodings
Parencodings Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 24932 Accepted: 14695 De ...
- Win10遇上Kindle就蓝屏
在使用 Kindle 连接 Win10 时会出现蓝屏现象,现在,微软承认 Windows 10 插入 Kindle 导致蓝屏问题,并表示目前正着手制作补丁.微软表示:“我们承认确实存在当Kindle ...
- 【管理工具】Git的安装与使用
公司与公司合并,需要学习一下git的使用.从网上找了一篇资料,完全满足需求,先赞一个. http://www.cnblogs.com/Bonker/p/3441781.html 下面记录一下自己的安装 ...
- nginx配置:location配置方法及实例详解
今天深入研究了下nginx的location的用法,已经一些需要注意的细节,现在做一个归纳总结,以备后面查询. location匹配的是nginx的哪个变量? $request_uri locatio ...
- gcc编译器与基本类型3
C语言发展史 1969年贝尔实验室 肯尼斯·蓝·汤普逊,丹尼斯·李奇开发了B语言 ->Unix,New B语言,改名C语言83年提出C语言标准 1989年十二月正式通过C语言标准,C89标准 C ...
- ldconfig报错 :libstdc++.so.6.0.18-gdb.py不是一个elf文件
今天安装wxWidgets,输入ldconfig竟然提示 /usr/lib64/libstdc++.so.6.0.18-gdb.py 不是一个elf文件,开头魔数错误 摸不着头脑,上网搜了一下,有说是 ...
- node-mysql中的连接池代码学习
node-mysql是一个node.js下的mysql驱动,前段时间在处理连接池的问题上遇到了连接不释放的疑难杂症,虽已解决,但仍需总结经验避免下次重蹈覆辙.下面是node-mysql中的连接池的部分 ...
- 设计模式系列 1——StaticFactory(静态工厂),AbstractFactory(抽象工厂)
本文出自 代码大湿 代码大湿 本系列持续更新,敬请关注. 1 静态工厂 静态工厂介绍: 静态工厂模式可以实现接口封装隔离的原则.在客户端只知接口而不知实现的时候可以使用静态工厂模式. 源码请点击我 角 ...
- Spring For Android初体验
Spring For Android是Spring框架的一个扩展,其主要目的在乎简化Android本地应用的开发,这其中包括了你可以使用该项目提供的 RestTemplate来为你的Android客户 ...