URL path of ionic application

I have craeted a blank ionic project and starting to build on it. I successfully created the blank project and it works as expected.

The app is available at

http://localhost/Projects/myapp/www/index.html

Now I want to add some routes to the project and so I have added the below code in the app.js file.

app.config(function($stateProvider, $urlRouterProvider) {
    $stateProvider.state('blogs', {
        url : "/blogs",
        templateUrl : "templates/blogs.html",
        controller : "BlogsCtrl"
    });
})

As the URL route is /blogs, I tried to access it across all types of combinations. But I get page not found error.

What's the actual url, where I can access /blogs page? Below are the few combinations that I tried.

http://localhost/Projects/myapp/www/index.html/blogs
http://localhost/Projects/myapp/www/index.html/#blogs

If URL defined as /blogs

The full path should be:

<AppRoot>/#/blogs

In your case:

http://localhost/Projects/myapp/www/#/blogs

You don't need to use index.html anyways:

http://localhost/Projects/myapp/www/#/index.html/blogs

Generally if you use $urlRouterProvider.otherwise:

for example

$urlRouterProvider.otherwise("/blogs");

After, you can just write http://localhost/Projects/myapp/www/#/


-- MAC --

If you test GUI on MAC, you can run:

cd to-your-project www

run:

python -m SimpleHTTPServer 8000

And after the URL will look like:

http://localhost:8000/#/blogs

The simplest way is:

$ cd Projects/myapp
$ ionic serve

Running dev server: http://192.168.1.4:8100
Running live reload server: http://192.168.1.4:35729

And you have live reload too! Enjoy