Hey everyone I am trying to work through a tutorial for Angularjs, and am stuck on some routing issues.

It seams like the route is actually working but no content is showing up in my section.

here is my code

<!DOCTYPE html >
<html data-ng-app="demoApp">
<head>
<title></title>
</head>
<body >
<div>
    <!-- Placeholder for views -->
    <div data-ng-view=""></div>
</div>
<script src="angular.min.js"></script>
<script src="angular-route.min.js"></script>

<script>
    var demoApp = angular.module('demoApp', ['ngRoute']);

    demoApp.config(function ($routeProvider) {
        $routeProvider
            .when('/',
                {
                    controller: 'SimpleController',
                    templateUrl: 'partials/home.html'
                })

            .otherwise({ redirectTo: '/' });
    });

    function SimpleController($scope) {
        $scope.customers = [
            { name: 'Blake', city: 'Redding' },
            { name: 'Nico', city: 'Portland' },
            { name: 'Simoneg', city: 'Bakersfield' },
            { name: 'Kyle', city: 'Washougal' }
        ];          
    }
</script>

</body>
</html>

Any help would be greatly appreciated.

Thanks a lot guys, I looked in my console and first found the bad link, I then found out that I could not do this without setting up a localhost for the project. I installed xampp used this tutorial to do it. http://www.textpattern.net/wiki/index.php?title=using_xampp_(apache-mysql-php-perl)_for_windows#VirtualHost_Containers_.28Optional.29

有帮助吗?

解决方案

Thanks a lot guys, I looked in my console and first found the bad link, I then found out that I could not do this without setting up a localhost for the project. I installed xampp used this tutorial to do it. http://www.textpattern.net/wiki/index.php?title=using_xampp_(apache-mysql-php-perl)_for_windows#VirtualHost_Containers_.28Optional.29

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top