angular.js - How to modify the url format of angular
PHP中文网
PHP中文网 2017-05-15 17:02:49
0
1
582

http://localhost/shop#/item/1000
I want to change it to http://localhost/shop#item-1000
I use $stateProvider


  .state('item', {
        url: '/item/:id',
        templateUrl: "/ionic/templates/item.html",
        controller:'ItemShowController'
      })

The above has also been changed. Changing it to url: 'item-:id', is useless

PHP中文网
PHP中文网

认证0级讲师

reply all(1)
黄舟

First generally #之前的路由是后端提供的,#之后的路由是由Angular控制的;#表明整个应用使用的是Angulardefault hash routing. If you want to change it to what you want, you can try this:

.state('item', {
        url: '/item-{id}', // 这里这样写路由
        templateUrl: "/ionic/templates/item.html",
        controller:'ItemShowController'
      })

This should be fine

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template