Skip to content Skip to sidebar Skip to footer

Angular Shared Model With Multiple Controllers

I am new to Angular and trying to clear my concepts: My app requires a single model which will be updated by different controllers. So, the model should be shared. Following link e

Solution 1:

As far as your case is concerned, Both services and factory can be used, as both of them are essentially similar in nature by functionalities.

As per my understanding, you want a single news entity, to be shared across all controllers, as per singleton design pattern, ensuring one update -> updates all. This can be perfectly implemented using Angular Services.

I myself find using services easier than factory method, since the former has an easy to use syntax :D

Also, for more understanding of Difference between the two approaches, you can have a look at this answer

enter image description here

Post a Comment for "Angular Shared Model With Multiple Controllers"