[AngularJS] accessing Services from Console

Source: Internet
Author: User

Using The Chrome console, you can access your AngularJS injectable services. This was down and dirty debugging, and can be a lifesaver in troubling times.

You can get the services/factories in console by using:

var $injector = angular.element ($). Injector ();

This $injector can-help-skip the form validations on the client side, but you do need to check the value on server side.

If you have the factory like:

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-can use any firsebase methods, for example:

Projects. $add ({name: "", Site: "", Description: "<<<<<<<<>>>>>>"})

Here site need to is a URL, but if access it from console, we still can add value into the IT:

[AngularJS] accessing Services from Console

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.