paynestrike
paynestrike

Reputation: 4658

How to hide url in angular?

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

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

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

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?

any idea?

Upvotes: 0

Views: 15491

Answers (1)

Buu
Buu

Reputation: 50335

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.

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

Upvotes: 5

Related Questions