5

I am following a tutorial on AngularJS - "Building a website with AngularJS"

The routes I am using are pretty much the same as the tutorial :

// JavaScript Document
angular.module('quest', []).
    config(function($routeProvider) {
        $routeProvider.
            when('/about', {template:'partials/about.html'}).
            when('/start', {template:'partials/start.html'}).
            otherwise({redirectTo:'/home', template:'partials/home.html'});
    });

The problem is: it only shows the path to the resource, instead of the contents of the resource, so instead of showing the html content, it just shows:

PARTIALS/ABOUT.HTML

I am not sure what I am doing wrong, but it does work, if i go to the #/about URL it shows "PARTIALS/ABOUT.HTML" if i change the url to index.html#/start it shows "PARTIALS/START.HTML"

html of page:

<!DOCTYPE html>
<html lang="en" ng-app="quest">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <title></title>
    </head>
    <body ng-controller="MainController">
        <script type="text/javascript" src="js/angular.min.js"></script>
        <script type="text/javascript" src="js/quest.js"></script>

        <div ng-view></div>

    </body>
</html>

1 Answer 1

11

Use templateUrl instead of template

Sign up to request clarification or add additional context in comments.

2 Comments

argghh! when i changed it to templateURL, it fails, I had the wrong case. Also the tutorial does not have Url, and it works. But, changed it to tempalteUrl and it works now. Thanks!
It's a bit obscure on the official website.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.