-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFeatures.txt
More file actions
24 lines (9 loc) · 1.13 KB
/
Features.txt
File metadata and controls
24 lines (9 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Now that you've seen how to create modules and how modules are created then can be used to define routes and also work with controllers, we're going to wrap up by talking about some re-use Concepts.
Another Feature of AngularJS is the ability to encapsulate data functionality into factory, services , provider, or little value providers.
There diffrence B/w the Three is just in way in which they create the object that goes and gets the data.
Factories:- With the Factory you Actually (Create an Object) inside of the factory and return it.
Service:- With the Service you just have a standard function that uses (this) keyword to define function.
Provider:- With the Provider there's a ($get) you define and it can be used to get the object that returns the data.
Value:- (is just a way to get for instance a config value) .
So For Instance if We Need to go and get customers and I need those customers in multiple controllers , If we didn't want to hard code that data in each controller . It just wouldn't make sense and there'd be a lot of duplication there.
(Instead What I'll do is move that code out to a factory, service or provider.)