[AngularJS] Accessing Services from Console
Using the Chrome console, you can access your AngularJS injectable services. This is down and dirty debugging, and can be a lifesaver in troubling times.
You can get services/factories in console by using:
var $injector = angular.element($0).injector();
This $injector can help to skip the form validations on client side, but you do need to check the value on server side.
If you have factory like:
.factory('Projects', function($firebase, fbURL) {
return $firebase(new Firebase(fbURL)).$asArray();
})
You can access it by using:
var Projects = $injector.get("Projects");
Because it uses firebase, therefore, now you can use any firsebase methods, for example:
Projects.$add({name:"", site:"", description: "<<<<<<<<>>>>>>"})
Here site need to be a URL, but if access it from console, we still can add value into the it:
[AngularJS] Accessing Services from Console的更多相关文章
- [AngularJS] Accessing Scope from The Console
Using Angular, you can actually access the scope and other things from the console, so when you have ...
- AngularJS 之Services讲解
Angular带来了很多类型的services.每个都会它自己不同的使用场景.我们将在本节来阐述. 首先我们必须记在心里的是所有的services都是singleton(单例)的,这也是我们所希望得到 ...
- [AngularJS] Using Services in Angular Directives
Directives have dependencies too, and you can use dependency injection to provide services for your ...
- [AngularJS] Accessing The View-Model Inside The link() When Using controllerAs
If u using controller & controllerAs in directive, then the link()'s 4th param 'controller' will ...
- [AngularJS] Accessing Data in HTML -- controllerAs, using promises
<!DOCTYPE html> <html> <head> <title>Access Data From HTML</title> < ...
- [转]调试AngularJS应用
原文链接:Debugging AngularJS Apps from the Console 当我们开发AngularJS应用的时候,我们想在Chrome/FF/IE控制台调试隐藏在应用中的数据和服务 ...
- .NET CORE——Console中使用依赖注入
我们都知道,在 ASP.NET CORE 中通过依赖注入的方式来使用服务十分的简单,而在 Console 中,其实也只是稍微绕了个小弯子而已.不管是内置 DI 组件或者第三方的 DI 组件(如Auto ...
- Decoration2:引入Angularjs显示前台一条数据
SpringMVC内置的RestFul API格式采用的是最复杂最全面的HATEOAS规范,对于简单应用来说,前台解析起来不方便,我们下面主要想办法重新定义一种简单的RestFulAPI. (1)先是 ...
- 【MVC5】First AngularJS
※本文参照<ASP.NET MVC 5高级编程(第5版)> 1.创建Web工程 1-1.选择ASP.NET Web Application→Web API 工程名为[atTheMovie] ...
随机推荐
- ansible官方文档翻译之变量
Ansible变量 在使用ansible变量的时候,主要是因为各个系统的不同,从而需要使用不同的变量来进行设置,例如在设置一些配置文件的时候,有大部分内容是相同的,但是一部分内容是和主机的ip地址或者 ...
- bzoj 1806 [Ioi2007]Miners 矿工配餐(DP)
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=1806 [题意] 给定一个权在1..3内的序列,在保持相对位置不变的情况下拆分成两个序列 ...
- stl 中List vector deque区别
stl提供了三个最基本的容器:vector,list,deque. vector和built-in数组类似,它拥有一段连续的内存空间,并且起始地址不变,因此 它能非常好的支持随 ...
- how to install flash
Choice 1: Install Flash from Repository: This is fairly simple and easy and should work from most p ...
- [翻译]HTML中不知名的语义标签
原文:http://docs.webplatform.org/wiki/tutorials/Lesser_-_known_semantic_elements HTML5中比较常用的语义元素有heade ...
- c++ List、Vector、Stack、Queue使用
一.List使用 引入头文件#include <list> List基本函数Lists将元素按顺序储存在链表中. 与 向量(vectors)相比, 它允许快速的插入和删除,但是随机访问却比 ...
- Educational Codeforces Round 5 A. Comparing Two Long Integers
A. Comparing Two Long Integers time limit per test 2 seconds memory limit per test 256 megabytes inp ...
- JVM系列二:GC策略&内存申请、对象衰老
JVM里的GC(Garbage Collection)的算法有很多种,如标记清除收集器,压缩收集器,分代收集器等等,详见HotSpot VM GC 的种类 现在比较常用的是分代收集(generatio ...
- OperateParticleWithCodes
[OperateParticleWithCodes] Listing 6-6 shows how you might configure an emitter’s scale property. Th ...
- LC并联谐振回路