V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
lyseky
V2EX  ›  Angular

有人懂 angular 的路由规则吗

  •  
  •   lyseky · 2016-01-27 12:02:57 +08:00 · 2770 次点击
    这是一个创建于 3002 天前的主题,其中的信息可能已经有所发展或是发生改变。

    怎么默认访问主页的时候不要显示这段,如:http://localhost:63342/mulan-angular/client/src/

    //设置路由
    myApp.config(function ($stateProvider,$urlRouterProvider,$locationProvider) {
    //去掉路由中的[#]
    $locationProvider.html5Mode({
    enabled: true,
    requireBase: false});
    $stateProvider
    .state('home',{
    url:"/",
    templateUrl:"mulan-angular/client/src/index.html",
    });
    // $urlRouterProvider.otherwise('/');
    });

    6 条回复    2016-01-27 13:07:10 +08:00
    clijiac
        1
    clijiac  
       2016-01-27 12:10:51 +08:00
    你这个用的是 ui-router 吧 ,没用过
    看看这个 http://bubkoo.com/2014/01/02/angular/ui-router/guide/url-routing/
    lyseky
        2
    lyseky  
    OP
       2016-01-27 12:14:39 +08:00
    @clijiac 我想访问端口就直接是项目主页了,怎么设置
    aivier
        3
    aivier  
       2016-01-27 12:16:40 +08:00   ❤️ 1
    这是 WebStorm 的调试地址,那上面的是你自己的项目文件夹路径吧,去不掉,你换个 Nginx 应该就没有了
    bdbai
        4
    bdbai  
       2016-01-27 12:24:41 +08:00 via iPhone
    同楼上, router 换的是路径后面的部分,前面归服务器管。
    lyseky
        5
    lyseky  
    OP
       2016-01-27 13:06:58 +08:00
    @aivier 人才,居然知道我用的 ide
    lyseky
        6
    lyseky  
    OP
       2016-01-27 13:07:10 +08:00
    @bdbai 3q
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3249 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 13:54 · PVG 21:54 · LAX 06:54 · JFK 09:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.