如何隐藏URL中的角? [英] How to hide url in angular?

查看:127
本文介绍了如何隐藏URL中的角?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能不使用angualar路线,因为如果我这样定义一个路线:

Is it possible to not using angualar routes, because if I defined an routes like:

app.config(function($routeProvider){
    $routeProvider.when('/home')
})

我的网址看起来像www.app.com/#home,

my url will look like www.app.com/#home,

我不想改变网址,只需www.app.com非常干净的,在这种情况下,如何为不同模式控制器和如何加载模板NG-视图定义的模板,以及如何通过URL参数?

I dont want to change url, just www.app.com nice and clean, in this case how to defined template for defferent controller and how to load the template in ng-view, and how to pass url parameter?

任何想法?

推荐答案

您不能做到这一点与内置的路由机制,因为路径需要每路线。但是,您可以使用 UI路由器库,以创建网址少的状态和导航他们使用无论是code或指令

You cannot do that with the built-in routing mechanism because path is required for every route. However, you can use ui-router library in order to create URL-less states and navigate to them using either code or directive.

我创造了这个 plunker 来演示如何使用 UI路由器状态之间导航,而无需修改URL。

I created this plunker to demonstrate how to use ui-router to navigate among states without modifying URL.

这篇关于如何隐藏URL中的角?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆