angularjs - angular ui router nested state with params cannot load stylesheet -


i'm still new angular ui router , have problem nested state / nested views need help. have angular app using ui.router states definition bellow:

$locationprovider.html5mode(true);     $stateprovider        .state('root',{            abstract:'true'            views:{                  'top@':{},                  '@':{}                  }                  })        .state('childone',{            url:'/childone,            parent:'root'            views:{                  'top':{ template:"top navigation bar"},                   '':{template:"main navigation"}                  }             }); 

for childone state, every thing work expected until add params state :

... .state('childone',{    url:"/childone/:child_id",    parent:"root",    views:{          'top@':{                  template:"top navigation styling in app.css"                  }           '@':{                  template:"main contain style"               }          } }); 

now. if navigate childone state using link (ui-sref=({child_id:'1232'})) page load stylesheet , apply elements ok. if refresh state or go there directly using url, page broken, no styles apply element broke view. tried many options , solution here nothing work me far. point me out i'm missing / wrong here please.

( i'm trying build mean stack app. )

edit: node/express server side serve static index.html file:

var express = require('express'); var app = express(); var server = require('http').server(app); var port = process.env.port||80; var mongoose = require('mongoose'); //var passport = require('passport'); //will used later var bodyparser = require('body-parser'); var cookie = require('cookie-parser'); var path = require('path'); var session = require('express-session'); var dbconf = require('./app/config/db'); var flash = require('connect-flash'); var conf = require('./app/config/app'); mongoose.connect(dbconf.mongo);  /*middleware*/ app.use(cookie(conf.secret)); app.use(session({cookie: { maxage: 60000 }})); app.use(flash()); app.use(express.static(__dirname + '/public'));  app.use(bodyparser()); app.use(bodyparser.json({type: "application/vnd.api+json"})); app.use(bodyparser.urlencoded({extended: true}));   app.get('*',function(req,res) {     res.sendfile(path.join(__dirname, '/public/' + 'index.html')); });  app.use(function(req,res) {     res.status(404);     res.send('the path not exist'); });  server.listen(port); console.log('http server on , serving @ port ' + port); 


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -