UrbanPro
true

Learn jQuery from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Learn jQuery with Free Lessons & Tips

Ask a Question

Post a Lesson

All

All

Lessons

Discussion

Lesson Posted on 25/09/2017 Learn jQuery +4 Angular.JS Java Script Training .Net .Net MVC

Dependency Injection in Angular 2

Ranjan Panda

I am .Net Trainer with more than 6 years Industry experience in Microsoft .net technologies, Expertise...

Dependency injection Dependency injection is a way to supply a new instance of a class with the fully-formed dependencies it requires. Most dependencies are services. Angular uses dependency injection to provide new components with the services they need. Angular can tell which services a component... read more

Dependency injection

Service

Dependency injection is a way to supply a new instance of a class with the fully-formed dependencies it requires. Most dependencies are services. Angular uses dependency injection to provide new components with the services they need.

Angular can tell which services a component needs by looking at the types of its constructor parameters. For example, the constructor of your HeroListComponent needs a HeroService:

Sample Code-

src/app/hero-list.component.ts (constructor)
constructor(private service: HeroService) { }

When Angular creates a component, it first asks an injector for the services that the component requires.

An injector maintains a container of service instances that it has previously created. If a requested service instance is not in the container, the injector makes one and adds it to the container before returning the service to Angular. When all requested services have been resolved and returned, Angular can call the component's constructor with those services as arguments. This is dependency injection.

The process of HeroService injection looks a bit like this:

Service

If the injector doesn't have a HeroService, how does it know how to make one?

In brief, you must have previously registered a provider of the HeroService with the injector. A provider is something that can create or return a service, typically the service class itself.

You can register providers in modules or in components.

In general, add providers to the root module so that the same instance of a service is available everywhere.

src/app/app.module.ts (module providers)
providers: [
BackendService,
HeroService,
Logger
],

Alternatively, register at a component level in the providers property of the @Component metadata:

src/app/hero-list.component.ts (component providers)
@Component({
  selector:    'hero-list',  templateUrl: './hero-list.component.html',  providers:  [ HeroService ]})

Registering at a component level means you get a new instance of the service with each new instance of that component.

Points to remember about dependency injection:

  • Dependency injection is wired into the Angular framework and used everywhere.

  • The injector is the main mechanism.

    • An injector maintains a container of service instances that it created.
    • An injector can create a new service instance from a provider.
  • provider is a recipe for creating a service.

  • Register providers with injectors.

read less
Comments 1
Dislike Bookmark

Lesson Posted on 25/09/2017 Learn jQuery +2 Angular.JS Java Script Training

Mark And Sweep Algorithm in Javascript Memory Management

Ranjan Panda

I am .Net Trainer with more than 6 years Industry experience in Microsoft .net technologies, Expertise...

This algorithm reduces the definition of "an object is not needed anymore" to "an object is unreachable". This algorithm assumes the knowledge of a set of objects called roots (In JavaScript, the root is the global object). Periodically, the garbage-collector will start from these roots, find all objects... read more

This algorithm reduces the definition of "an object is not needed anymore" to "an object is unreachable".

This algorithm assumes the knowledge of a set of objects called roots (In JavaScript, the root is the global object). Periodically, the garbage-collector will start from these roots, find all objects that are referenced from these roots, then all objects referenced from these, etc. Starting from the roots, the garbage collector will thus find all reachableobjects and collect all non-reachable objects.

This algorithm is better than the previous one since "an object has zero reference" leads to this object being unreachable. The opposite is not true as we have seen with cycles.

As of 2012, all modern browsers ship a mark-and-sweep garbage-collector. All improvements made in the field of JavaScript garbage collection (generational/incremental/concurrent/parallel garbage collection) over the last few years are implementation improvements of this algorithm, but not improvements over the garbage collection algorithm itself nor its reduction of the definition of when "an object is not needed anymore".

read less
Comments
Dislike Bookmark

Lesson Posted on 30/05/2017 Learn jQuery

jquery add class,remove class,toggle class video

Mohit Gaur

Currently I am working in Sphinx World Biz Ltd. company. I have more than 5 years Experience in Web Designing,...

https://www.youtube.com/watch?v=LUp1fYvEYgM
Comments
Dislike Bookmark

Learn jQuery from the Best Tutors

  • Affordable fees
  • Flexible Timings
  • Choose between 1-1 and Group class
  • Verified Tutors

Lesson Posted on 13/05/2017 Learn jQuery

jquery val method

Mohit Gaur

Currently I am working in Sphinx World Biz Ltd. company. I have more than 5 years Experience in Web Designing,...

How to use jquery val method?
Comments
Dislike Bookmark

Lesson Posted on 13/05/2017 Learn jQuery

jquery text method

Mohit Gaur

Currently I am working in Sphinx World Biz Ltd. company. I have more than 5 years Experience in Web Designing,...

How to use jquery text method?
Comments
Dislike Bookmark

Lesson Posted on 13/05/2017 Learn jQuery

jquery selectors

Mohit Gaur

Currently I am working in Sphinx World Biz Ltd. company. I have more than 5 years Experience in Web Designing,...

How to use jquery selectors?
Comments
Dislike Bookmark

Learn jQuery from the Best Tutors

  • Affordable fees
  • Flexible Timings
  • Choose between 1-1 and Group class
  • Verified Tutors

Lesson Posted on 03/05/2017 Learn jQuery

jquery Menu by me

Mohit Gaur

Currently I am working in Sphinx World Biz Ltd. company. I have more than 5 years Experience in Web Designing,...

How to make Mobile Menu in JQuery?
Comments
Dislike Bookmark

Lesson Posted on 03/05/2017 Learn jQuery

Jquery Tab Create By Me In Jquery

Mohit Gaur

Currently I am working in Sphinx World Biz Ltd. company. I have more than 5 years Experience in Web Designing,...

How to make Tabs in JQuery?
Comments
Dislike Bookmark

Answered on 24/02/2017 Learn jQuery

Shabana p.

Trainer

Try real time examples by logically thinking and practicing.
Answers 13 Comments
Dislike Bookmark

Learn jQuery from the Best Tutors

  • Affordable fees
  • Flexible Timings
  • Choose between 1-1 and Group class
  • Verified Tutors

Lesson Posted on 19/01/2017 Learn jQuery

what is jquery and why we use it ?

Suraj Ghosi

My skills asp.net , asp.net mvc , mvc+web api , javascript , jquery, html5 ,css3 , bootstrap, sql server...

Jquery : - it is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development Advanctage of Jquery :- It helps to improve the performance of the application It helps to develop most browser compatible web... read more

Jquery : - it is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development

Advanctage of Jquery :-

  • It helps to improve the performance of the application
  • It helps to develop most browser compatible web page
  • It helps to implement UI related critical functionality without writing hundreds of lines of codes
  • It is fast
  • It is extensible – jQuery can be extended to implement customized behavior
  • The price is right. The jQuery library is free.
  • It's light. Since jQuery pushes content to the client, it therefore reduces the wait time for server response. Plus, it's smaller than Flash, so it results in smoother playbacks and less errors.
  • It works anywhere. HTML5 is cross-browser compatible-it will work on any browser, mobile phone or tablet, and even on Apple devices.
  • There's a low learning curve. Since it's based on plain old JavaScript, developers can learn jQuery fast.
  • Finally, jQuery is SEO friendly and CSS3 compliant.

 

I hope this lesson increase your knowledge about jquery basic .

Let us know if you have any concern.

read less
Comments
Dislike Bookmark

About UrbanPro

UrbanPro.com helps you to connect with the best jQuery Training in India. Post Your Requirement today and get connected.

Overview

Lessons 15

Total Shares  

+ Follow 4,123 Followers

Top Contributors

Connect with Expert Tutors & Institutes for jQuery

x

Ask a Question

Please enter your Question

Please select a Tag

X

Looking for jQuery Classes?

The best tutors for jQuery Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn jQuery with the Best Tutors

The best Tutors for jQuery Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more