Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • AngularJS Basic, Value, Service, Factory & Provider Example and description

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 186
    Comment on it

    Hi Readers,

    I recently got my attention to new JavaScript framework that is AngularJS. I read lots of articles about it but I usually do not understand anything just by reading about it. I am more about the practical person and can not actually make difference until I actually create small examples for better understanding. I knew the same case is with many of my friends out there who would like to see small examples.


    This is just a small try to give everyone a sneak peek to the main features you hear about when you read AngularJS. In the following examples I tried to get the area of a circle with the radius entered by the end user. As my main motive is to give readers a very simple example to see the working of it without complicating the things.


    To understand about all these please read AngularJS documentation : https://docs.angularjs.org/guide/providers

    1) Basic radius example.

    a) Simple AngularJS example :-
    http://jsfiddle.net/harneet/HB7LU/15595
    
    b) Simple AngularJS example with constant:-
    http://jsfiddle.net/harneet/HB7LU/15597
    

    2) Radius using Service.

    a) Simple Services example :- 
    http://jsfiddle.net/harneet/HB7LU/15603
    
    b) Advance Service example :- 
    http://jsfiddle.net/harneet/HB7LU/15607
    

    3) Radius using Value.

    a) Simple Value example :- 
    http://jsfiddle.net/harneet/HB7LU/15604
    
    b) Advance Value example :- 
    http://jsfiddle.net/harneet/HB7LU/15609
    

    4) Radius using Factory.

    a) Simple Factory example :- 
    http://jsfiddle.net/harneet/HB7LU/15605
    
    b) Advance Factory example :- 
    http://jsfiddle.net/harneet/HB7LU/15620
    
    b) Advance Factory example with constant:- 
    http://jsfiddle.net/harneet/HB7LU/15621
    

    5) Radius using Provider.

    a) Simple Provider example :- 
    http://jsfiddle.net/harneet/HB7LU/15606
    
    b) Advance Provider example :- 
    http://jsfiddle.net/harneet/HB7LU/15622
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: