asp.net mvc - AngularJS routing failure -
please can tell me why views not being inserted ng-view placeholder? i'm using standard visual studio mvc project template homecontroller , .cshtml files in /views/home
i'm browsing http://localhost:12345/home/example04#/view1
i see example04 header not contents of _view01.cshtml
here rendered html:
<!doctype html> <html ng-app="movieapp"> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width" /> <title>example04</title> <link href="/content/site.css" rel="stylesheet"/> <script src="/scripts/modernizr-2.5.3.js"></script> </head> <body> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script> <h2>example04</h2> <div> <div ng-view=""></div> </div> <script> var movieapp = angular.module('movieapp', []); movieapp.config(function($routeprovider) { $routeprovider .when('/view1', { controller: 'moviecontroller', templateurl: '_view1.cshtml' }) .when('/view2', { controller: 'moviecontroller', templateurl: '_view2.cshtml' }) .otherwise({ redirectto: 'view1' }); }); movieapp.controller('moviecontroller', function ($scope) { $scope.moviestars = [ { name: 'bruce willis', character: 'john mcclane' }, { name: 'sigourney weaver', character: 'ripley' }, { name: 'tom cruise', character: 'ethan hunt' }, { name: 'harrison ford', character: 'indiana jones' } ]; }); </script> <script src="/scripts/jquery-1.7.1.js"></script> </body> </html>
Comments
Post a Comment