1

Is there a way to refresh a controller from another controller?

For example, Controller1 runs then Controller2 runs. At the end of Controller2 there is a "command" to re-run Controller1. Is this possible?

In my post I had made earlier it seems like my questions was unclear what I was trying to do. Here is a link to it. Updating a controller from another controller Angular

1
  • Why do you want to do this? Perhaps if I had more information, I could convince you that there's a better way to do whatever you're trying to do :P Commented Feb 18, 2014 at 21:15

3 Answers 3

2

if you are using ngRoute there is a method to re-run the all the controller without having to reload the page.

app.controller('MyCtrl', function($route){
    $route.reload()
})
Sign up to request clarification or add additional context in comments.

2 Comments

This solved my problem. Not really the way I had anticipated, but it works.
Not a good solution. It will reload all the controllers, not only the other one, so you will loose the current $scope.
0

If you want to refresh data, please use services and refresh data in the services. Sequential things can be done of ajax by using promises. Please let me know if you need any help in designing the solution

Comments

0

I think you need to look into using directives. By using directives you can encapsulate and share scope objects.

Please read the documentation on directives and "shared scope".

http://docs.angularjs.org/guide/directive

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.