angular routes in angularJs does not show anything

1

I am using angularjs and I use the angular routes, this is my configuration

var myapp = angular.module('automate', ["ngRoute"]);

myapp.config(function($routeProvider){
    $routeProvider
        .when("/", {
            templateUrl:"templates/home.html"
        })
        .when("/automate",{
            templateUrl: "templates/automates.html"
        })
});

This is my Index.html file

<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8"> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0"/>
    <title>Automan</title>
    <link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/>
    <link rel="icon" href="images/icon.ico">
    <link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/custom-animations.css">
</head>
<body>
<ng-view></ng-view>
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="node_modules/retinajs/dist/retina.js"></script>
<script src="node_modules/jquery-unveil/jquery.unveil.js"></script>
<script src="node_modules/angular/angular.min.js"></script>
<script src="js/angular-route.min.js"></script> 
<script src="js/app.js"></script>
</body>
</html>

But at the moment of running the application, it does not show me anything in the ngview, but there is also no error in the console

    
asked by Ernesto Emmanuel Yah Lopez 06.03.2018 в 16:25
source

1 answer

1

I think you need to initialize your angle application with the directive ng-app="module_name" . Without this directive it is impossible for angularjs to find out that it has to be executed automatically.

<body ng-app="automate"> <ng-view></ng-view> </body>

    
answered by 06.03.2018 в 16:28