Angular JS routes do not work, only shows the path to partial, not partial

I am following an AngularJS tutorial - Building a website using AngularJS

The routes I use are almost the same as in 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'});
    });

Problem : it only shows the path to the resource, not the content of the resource, so instead of displaying the html content, it just shows:

PARTIALS/ABOUT.HTML

I'm not sure what I'm doing wrong, but it works if I go to the # / about URL, which shows “PARTIALS / About.HTML”, if I change the index.html URL # / starts it “partial / start. html "

html pages:

<!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>
+5
source share
1 answer

Use templateUrlinsteadtemplate

+11
source

All Articles