Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Ze Yang
Ze Yang
495 Points

ng-view doesn't work!

I try to use ng-view to rout to another html file. But it 's didn't work here is my code:

<!DOCTYPE html>
<html ng-app="app">
    <meta charset="UTF-8">
    <title>Insert title here</title>
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" />
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.0/css/font-awesome.css" />
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js"></script>
    <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular-route.js"></script>
    <script src="app.js"></script>
<body ng-controller="homecntrl">
    <nav><a href="#neworder">New Order


    <table >
        <tr ng-repeat="product in products">

    <div id="main">
        The view displays here...
        <div ng-view>Bingding</div>
var app = angular.module("app", ['ngRoute']);
app.configure = (function ($routeProvider) {

        .when('/neworder', {
            templateUrl: 'neworder.html',
        controller: 'newcntrl'


app.controller("homecntrl", function ($scope, $http) {
    $http.get('products.json').success(function (data) {

        $scope.products = data;

app.controller("newcntrl", function ($scope) {
    $scope.message = "THis is a New Order";
    <div class="jumbotron text-center">

1 Answer

Mike Ulvila
Mike Ulvila
16,268 Points

You need an ng-app="app" on the body tag, then you can move your ng-controller to the next level div.