0

I have an angular application.on click of a tag, I am populating another div. Now I have a requirement to change the route as well on the click of the tag. how can I do this using Angularjs?

1 Answer 1

2

You can call a function on the scope as the click event handler.

For example: In your controller you have

$scope.myClickHandler = function() {
  populateDiv();
  changeRoute();
}

In your HTML template:

<div ng-click="myClickHandler()></div>
Sign up to request clarification or add additional context in comments.

2 Comments

And how to change the route inside the changeRoute method?
You can use $location.path('/newroute');

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.