angularjs取Sevice和directive的引用
取Sevice和directive的引用
3: Grab any Services
We can grab a reference to any service using the injector function of element where ngApp was defined (or grab the $rootElement manually if using angular's bootstrap method):
> angular.element('html').injector().get('MyService')
-> Object {undo: function, redo: function, _pushAction: function, newDocument: function, init: function…}
We can then call methods on that service just like we could if we injected it.
4: Access controller for directive
Some directives define a controller with certain additional (often shared) functionality. To access the instance of a controller for a given directive from the console, just use the controller() function:
> angular.element('my-pages').controller()
-> Constructor {}
This last one is more advanced and not used as frequently.
angularjs取Sevice和directive的引用的更多相关文章
- AngularJS系统学习之Directive(指令)
本文转自https://www.w3ctech.com/topic/1612 原文作者: Nicolas Bevacqua 原文:AngularJS’ Internals In Depth, Part ...
- angularjs可交互的directive
angularjs可交互的directive http://jsfiddle.net/revolunet/s4gm6/ directive开发上手练手,以注释的方式说明 html <body n ...
- AngularJS入门心得1——directive和controller如何通信
粗略地翻了一遍<JavaScript DOM编程艺术>,就以为可以接过AngularJS的一招半式,一个星期过去了,我发现自己还是Too Young,Too Simple!(刚打照面的时候 ...
- AngularJs(Part 11)--自定义Directive
先对自定义Directive有一个大体的映像 myModule.directive('myDirective',function(injectables){ var directiveDefiniti ...
- AngularJS学习笔记之directive—scope选项与绑定策略
From:http://www.linuxidc.com/Linux/2015-05/116924.htm scope:{}使指令与外界隔离开来,使其模板(template)处于non-inherit ...
- angularjs学习笔记三——directive
AngularJS 通过被称为 指令 的新属性来扩展 HTML. 正如你所看到的,AngularJS 指令是以 ng 作为前缀的 HTML 属性. HTML5 允许扩展的(自制的)属性,以 data- ...
- AngularJS学习笔记之directive——scope选项与绑定策略
开门见山地说,scope:{}使指令与外界隔离开来,使其模板(template)处于non-inheriting(无继承)的状态,当然除非你在其中使用了transclude嵌入,这点之后的笔记会再详细 ...
- 【温故知新C/C++/opencv】取址符&||cv::groupRectangles||引用与值传递
cv::groupRectangles void groupRectangles(vector<Rect>& rectList, int groupThreshold, doubl ...
- AngularJS创建新指令directive参数说明
var myapp = angular.module('myapp', []); myapp.directive('worldname', function() { return { template ...
随机推荐
- C# 笛卡尔积
void Main() { string[] str1 = { "a", "b" }; " }; string[] str3 = { "一& ...
- asp.net中两款文本编辑器NicEdit和Kindeditor
过Web开发的朋友相信都使用过富文本编辑器,比较出名的CuteEditor和CKEditor很多人应该已经使用过,在功能强大的同时需要加载的东西也变得很多.下面要推荐的两款富文本编辑器都是使用JS编写 ...
- Dapper多表查询(列名重复,类字段重复)映射方案
1. 一个主名,一个别名,设计时候属性和字段命名不同. 这样主名和别名都可以用的,在主名与别人重复时候用别名(别名可以设计的明确一点长一点,比如类名和字段结合) 2. 或者找一个字段多的直接继承出一个 ...
- jquery mobile最棘手的一个问题
大多数jquery mobile开发的妹子们都碰到过这个问题: 如何调用loading效果 这里给出一段代码,赶紧练手吧. //显示loading function showLoading(){ ...
- linux C 管道
单一进程使用管道基本上毫无意义.管道一般用来子进程和父进程之间的通信,或者兄弟进程间的通信. 创建管道的主要函数是pipe #include<unistd.h> ]) pipe函数创建一个 ...
- 内核同步机制 RCU
Evernote分享地址:http://www.evernote.com/shard/s133/sh/8807320d-f54d-4e90-a31b-e2a3d35509ee/7539dc3931b8 ...
- 关于Haproxy安装和配置:负载配置【haproxy.cfg】问题记录
1. 存放地址: more /etc/haproxy/haproxy.cfg ps -ef | grep haproxy 看看有没有haproxy的进程就是了 或者看看服务器的23306的端口有没有 ...
- urllib3 PoolManager
A pool manager is an abstraction for a collection of ConnectionPools.If you need to make requests to ...
- why does angular js rock
angularjs 入门教程 http://angular-tips.com/blog/2013/08/why-does-angular-dot-js-rock/ Practive the previ ...
- 二叉查找树(BST)
二叉查找树(BST):使用中序遍历可以得到一个有序的序列