I am new to angularjs. I just started creating a sample application. Please help me with your suggestions.
Below is my sample application.
Below are the pages created:
- page --> Notes.cshtml / notesController.js
- NotesList --> NotesList.cshtml / notesListController.js
- AddNote --> AddNote.cshtml / addNotecontroller.js
- ViewNote --> ViewNote.cshtml / viewNoteController.js
When user select a note from the noteslist, i want to load details on the right side (in ViewNote.cshtml). Please note that i can show only Add Note or View Note at a time.Hence, i am using ng-show to show/hide respective partial controls.
My question:
- When i click on a note from notes list, im calling server to fetch note details using a service.js. I understand that, the best way to share data b/w controllers is using a service. Hence, i kept the fetched data in service object.
- Now, i want to intimate view.cshtml to load the fetched data.
- Should i use $emit or $broadcast in service.js to intimate ViewNoteController.js ?
- I have service object injected into ViewNoteController.js
Is there a better way of handling this scenario? Pls suggest.
Aucun commentaire:
Enregistrer un commentaire