search

Home  >  Q&A  >  body text

angular.js - How does angularjs implement routing switching views through click events?

The page uses angular routing to switch different page views. If you do not use the a tag to switch, use ng-click to trigger some method judgments first, and then start the routing to switch views. Is this possible? If so, how should I write the statement? I haven't found any reliable cases online, so I'd like to ask you to answer your questions.

淡淡烟草味淡淡烟草味2757 days ago541

reply all(2)I'll reply

  • 某草草

    某草草2017-05-15 16:59:13

    If you use ngRouter, use $location.path to switch.
    If you use uiRouter, you can use state.go

    I’m here for Amway uiRouter

    reply
    0
  • PHP中文网

    PHP中文网2017-05-15 16:59:13

    It is also possible to change the current loaction through ng-click

    reply
    0
  • Cancelreply