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?

asked Mar 28, 2014 at 8:58

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>
answered Mar 28, 2014 at 9:08
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

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.