angular-sf-load
Manage AngularJS scope load.
When it comes to load resources in an AngularJS scope, things are very repetitive. Indeed, you have to manage with loading/failed/loaded etc... states all the time.
angular-sf-load
allows to do it by simply adding a promise state in your
controller/components state load/actions handling. Here is a simple example of
how to use it in a simple component:
Heroes <!-- Handle all states first load wait --> Loading...<!-- Handle all states first load failure --> Unrecoverable error: {{ $ctrl.states._all.failed.code }} <!-- States were loaded once --> {{ hero.name }} <!-- Cannot delete an hero twice + giving feedback ;) --> {{ $ctrl.actions['delete:' + hero._id].loading ? 'Delete' : 'Deleting' }} <!-- Handle hero list reload wait --> Refreshing...
// Example stolen from the AngularJS documentationangular ; { var ctrl = this; ctrldeleteHero = deleteHero; ; { sfLoadService; } { sfLoadService; }}
You can also see real world usage here.