-1

Hi Everyone I am working on an AngularJS project.

My project works fine on a route like: http://localhost/

But I have an admin panel like this: //localhost/admin/

So when I open this it's not working but when I put a complete URL like this: localhost/admin/index.html# then it works.

Project Structure is: Please Have A look on Project Structure

Blauharley
  • 4,186
  • 6
  • 28
  • 47
Rahish
  • 1
  • 1

2 Answers2

0

If you are running the website in IIS you need to set Default Documents or check if it is set. I had the same issue a while ago and found the not all default were set.

enter image description here

thewikus
  • 445
  • 1
  • 5
  • 16
0

You can create different states as per your project. For ex: 1. /login 2. /admin 3. /edit

and then you can mention configuration for each state with the html page you want to access. then you can use //localhost/admin and it will be referred by /admin state which you have created.

Code should be something like this

$stateProvider.state('admin',{
    url:'/admin',
    controller: 'AdminController',
    templateUrl:'admin/index.html',
    resolve: {
      loadMyFiles:function($ocLazyLoad) { // this can be used for lazy loading of files
        return $ocLazyLoad.load({
          name:'MYPROJECT',
          files:[
          'styles/admin.css'
          ]
        })
      }
    }
  })
schaturv
  • 122
  • 8