0

I've a file of index.html that has

     <ui-view></ui-view>

in the body and below is my route.js :

var app = angular.module('dashboard', ['ui.router']);

app.config(['$stateProvider','$urlRouterProvider','$locationProvider', function($stateProvider, $urlRouterProvider, $locationProvider) {
    $locationProvider.html5Mode(true);

    $urlRouterProvider.otherwise('/');

    $stateProvider
            .state("home", {
                url: "/",
                template:"<h1>home</h1>"
            })
            .state("dashboard", {
                url: "/dashboard",
                templateUrl: "templates/dashboard.html",
                controller: "controllers/dashboardCtrl"
            })           
}]);

but I get error of Cannot GET /dashboard I wonder why. I did have a folder called templates and has a dashboard.html in it.

7
  • show me the Url that how your calling in browser Commented Sep 3, 2016 at 7:11
  • 1
    Add your server-side code, please. Do you serving files from "template" folder in the root? Commented Sep 3, 2016 at 7:12
  • @KonstantinAzizov I have this app.use(express.static(path.join(__dirname, 'public'))); app.use(express.static(path.join(__dirname, 'templates'))); Commented Sep 3, 2016 at 7:52
  • @SaEChowdary localhost:3000/dashboard Commented Sep 3, 2016 at 7:54
  • stackoverflow.com/questions/20993766/… check out this link may help you Commented Sep 3, 2016 at 7:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.