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');

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.