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.

share|improve this question
    
show me the Url that how your calling in browser – Sa E Chowdary 17 hours ago
1  
Add your server-side code, please. Do you serving files from "template" folder in the root? – Konstantin Azizov 17 hours ago
    
@KonstantinAzizov I have this app.use(express.static(path.join(__dirname, 'public'))); app.use(express.static(path.join(__dirname, 'templates'))); – Thian Kian Phin 16 hours ago
    
@SaEChowdary localhost:3000/dashboard – Thian Kian Phin 16 hours ago
    
stackoverflow.com/questions/20993766/… check out this link may help you – Sa E Chowdary 16 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.