0

How do I convert the following url.action link to a boot strapped button.

<a data-ng-href="@Url.Action("Create", "Profile")" target="_self">Create New  </a>**strong text**

This button upon click needs to redirect the current page to Create Action and Profile Controller.

I am trying to bootstrap and angularize a legacy asp.net mvc 4 app.

Thanks

1 Answer 1

1

You can give an anchor tag a class of button which makes it look like a button but it can still contain a href. The alternative is in the controller to have a function to change the path using angulars $location service, eg:

$scope.setLocation = function(url) {
  $location.path(url)
};

in the html:

<div class="button" ng-click="setLocation('path/to/location');

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.