javascript - AngularJS ng-view not showing view -
i'm developing web app angularjs frontend , i'm trying set routing , showing views, far ng-include , other stuff work me not ng-view i'm developing in visual studio , when run app it's using local server (localhost)
here's directory structure
- asp.net project ---- css ---- scripts -------- app -------- app.js ----------- home -------------- controllers ------------------ index-controller.js ---- views ------- partials ---------- navbar.html ------- home.html - index.html
here's mi index.html
<!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>scolaris</title> <!--import materialize.css--> <link type="text/css" rel="stylesheet" href="content/materialize/css/materialize.css" media="screen,projection" /> <!--let browser know website optimized mobile--> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> </head> <body ng-app="app_module"> <ng-include src="'views/partials/navbar.html'"/> <div ng-view></div> <!--import jquery before materialize.js--> <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script> <script type="text/javascript" src="content/materialize/js/materialize.js"></script> <script type="text/javascript" src="scripts/angular.js"></script> <script type="text/javascript" src="scripts/angular-route.js"></script> <script type="text/javascript" src="scripts/app/app.js"></script> <script type="text/javascript" src="scripts/app/home/controllers/index-controller.js"></script> <script type="text/javascript" src="scripts/initialization.js"></script> </body> </html>
here's app.js
'use strict'; var app_module = angular.module('app_module', ['ngroute']); app_module.config(['$routeprovider', function ($routeprovider) { $routeprovider .when('/', { templateurl: '/views/home.html', controller: 'indexcontroller' }) .otherwise({ redirectto: '/' }); }]); /* tried ../../views/home.html, ../views/home.html, etc , nothing */
when load site loads correctly , if see requests can see it's requesting home.html 304 status code, thing div ng-view not showing html inside home.html, due to?
i've solved issue changing <ng-include>
tag <div ng-include="srctoview">
tag. if having issue i'd recommend doing this, or doing in answer using controller
thanks @sourabh- leading me answer.
Comments
Post a Comment