They can be injected into the controllers, filters, or directives.
In this portion, all the child pages are entered.
Step 6 Create myCtrl controller for index page and from this controller, we redirect page to Show.html
Step 7 In Show.html page, it shows data with the help of ShowCtrl controller, as shown below:
We are using ng-click=Edit (data) with this we are calling a function into showCtrl controller.
Step 8 Create showCtrl Controller and in this, we set dummy data to Students Scope, as shown below:
We can see in this controller that we are injecting myFactory and in edit function, we are assigning data to this Service.
We also injecting $location Service with the help of this, when we click the edit button i.e routing redirect to EditData routing and Edit.html page.
Step 9
Now, create Edit.html in this and for this page, we are creating EditCtrl controller. In this controller, we are receiving data from my factory.
Step 10 Now, set Index.html as a start page and run the Application. We will get output, as shown below:
Step 11 When we click the edit button, the data shown in Edit.html page will look as shown below: