Roads are not working, don't know why !

16 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Florian Hofer

ungelesen,
29.05.2015, 08:11:0829.05.15
an ang...@googlegroups.com
Hi, I followed a tutorial to find out how to use the angularjs routes. I did some, but nothing works:

My index:

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html ng-app>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

    </head>
    <body ng-app="MonApp">

        <div ng-view=""></div>

        <p>
            <a href="#/route1">route 1  </a><br />
        </p>

        <div>
            <label>Name:</label>
            <input type="text" ng-model="yourName" placeholder="Enter a name here">
            <hr>
            <h1>Hello {{yourName}}!</h1>
        </div>



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


            app.config(function($routeProvider) {
                $routeProvider
                        .when('/', {templateUrl: 'home.html'})
                        .when('/route1', {templateUrl: 'anime.html'})
                        .otherwise({redirectTo: '/'});
            });

        </script>

    </body>
</html>




All my files (home.html and anime.html) are on the same directory and I'm working in local:
But even when I arrive to my '/' page, nothing happens, I only have my index's stuff, but not the "home.html" page stuff. same for my route, doesn't work, only the url change:
but not the content. I could use a little help ^^' for any other informations, ask me. Thanks !


Allen antworten
Antwort an Autor
Weiterleiten
0 neue Nachrichten