0
Galley,
I am following the book ng-book of angular, and to make a SPA, I am using the following structure:
- app
- controller
controller.js
- js
main.js
- node_modules (com os arquivos de jquery, bootstrap e angular)
- templates
home.html
index.html
index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Título -->
<title>Treinando Angular</title>
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
</head>
<body ng-app="myApp">
<div ng-view></div>
<!-- Jquery -->
<script src="node_modules/jquery/dist/jquery.min.js"></script>
<!-- Bootstrap -->
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<!-- Angular -->
<script src="node_modules/angular/angular.min.js"></script>
<!-- Angular Route -->
<script src="node_modules/angular-route/angular-route.min.js"></script>
<!-- Main -->
<script src="js/main.js"></script>
<!--Controller -->
<script src="controller/controller.js"></script>
</body>
</html>
main.js
var app = angular.module("myApp", []);
app.config(function($routeProvider){
$routeProvider
.when("/", {
templateUrl: "templates/home.html",
controller: "HomeController"
})
.otherwise({ redirectTo: '/' });
});
controller js.
var app = angular.module("myApp", [ ]);
app.controller("HomeController", function(){
});
With this, my index.html does not render in the ng-view location, the content of the home page.html. Because I have already searched several pages, and even with angular-route.js does not work. I am using the Browser "Chrome".
How is your home.html?
– Rafael