我的观点不是渲染

时间:2014-12-26 11:30:34

标签: angularjs

我是angularjs的新手,我的问题是我无法使用路线渲染视图,这里是我的文件夹结构,我无法想象我的代码有什么问题

  • 的index.html

  • three.html

  • two.html

          <!DOCTYPE html>
            <html lang="en">
            <head>
                <title>AngularJS Routes example</title>
                <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"></script>
                <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular-route.min.js"></script>
            </head>
    
            <body ng-app="sampleApp">
    
            <a href="#/two">Route 2</a><br/>
            <a href="#/three">Route 3</a><br/>
    
            <div ng-view></div>
    
    
            <script>
                var app = angular.module("sampleApp", ['ngRoute']);
    
                app.config(['$routeProvider',
                    function($routeProvider) {
                        $routeProvider.
                            when('/three', {
                                templateUrl: 'three.html',
                                controller: 'RouteController'
                            }).
                            when('/two', {
                                templateUrl: 'two.html',
                                controller: 'RouteController'
                            }).
                            otherwise({
                                redirectTo: '/'
                            });
                    }]);
    
                app.controller("RouteController", function($scope) {
    
                })
            </script>
            </body>
    

0 个答案:

没有答案