javascript - ngRoute: URL changes, but the view stays the same -
i don't know i'm doing wrong, because url changes, view stays same.
app.js:
var app = angular.module('app', [ 'ngroute', 'ui.bootstrap', 'ui.bootstrap-slider', 'angularfileupload', 'ngtouch', 'nganimate', 'r' ]); app.config(['$routeprovider', function ($routeprovider) { $routeprovider .when('/data', { templateurl: 'html/data/data.html', controller: 'rcontroller' }) .otherwise({ templateurl: 'html/start/start.html' }); }]); index.jade:
doctype html html(ng-app='app') meta(charset='utf-8') head title i-coda link(rel='shortcut icon', href='./img/icon.ico') link(rel="stylesheet", href="./css/main.css") body(ng-controller='rcontroller') div#navigation.navbar.navbar-default.navbar-fixed-top(role='navigation') div.container div.navbar-header button.navbar-toggle.navbar-collapse(aria-expanded='false') span.sr-only toggle navigation span.icon-bar span.icon-bar span.icon-bar a.navbar-brand(href='./index.html') img#logo(src="./img/logo.svg", alt="i-coda logo") div.collapse.navbar-collapse.navbar-right ng-include(src="'./html/navbar/navbar.html'") div#main div(ng-view) footer.container.col-lg-12 script(src="./js/dependencies.js") script(src="./js/bundle.js") navbar.jade:
ul.nav.navbar-nav li.active a(href='#/start.html') start page li.active a(href='#/data.html') data the structure of project looks this:
| |_server.r |_www |___html |___css |___js |___index.html i looked @ similar posts , tried everything, didn't work. give me hint?
you doing in wrong way. rcontroller set on body presenting of content inside body regardless whatever router make, while should set /data route only.
removing body, or, set controller such mastercontroller (you have create it).
then create route /start (which should have controller + view similars /data route have) default option, , define otherwise option this
.otherwise({ redirectto: '/start' });
Comments
Post a Comment