Been bashing my head against this for a couple of hours now and I'm out of ideas. I'm brand new to angular and trying to build a very basic application just to get a handle on it.
Relevant parts of the application are as follows:
main.html
<!doctype html>
<html>
<head>
<link href="css/main.css" rel="stylesheet" type="text/css"></link>
<link href="https://fonts.googleapis.com/css?family=Comfortaa" rel="stylesheet">
</head>
<body ng-app="weatherApp">
<div class="main">
<div class="navbar">
<div class="vCentered">
<img src="assets/logo.png" id="logo">
</div>
</div>
<div ng-view>
</div>
</div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular-route.js"></script>
<script src="js/app.js"></script>
</html>
app.js
var app = angular.module("weatherApp", ["ngRoute"]);
app.config(function($routeProvider)
{
$routeProvider
.when('/', {
templateUrl: "home.html";
})
.otherwise({
redirectTo: '/'
});
});
home.html
<h1>Hello.</h1>
Very basic. The issue is that, no matter what, I can't get the contents of home.html to show up when main.html is loaded. Note that the content does display when I use the following code in app.js:
$routeProvider
.when('/', {
template: "Hello.";
})
So it appears to be some kind of problem with templateUrl actually finding home.html.
I have put home.html everywhere. It's littered throughout my PC now on the off chance that templateUrl is hunting for it there but so far no luck in having anything load.
I have tried turning on Internet Information Services on my machine and putting the project into the inetpub/wwwroot folder but that hasn't helped. (Running Windows 10)
Any ideas on what I'm doing wrong would be very much appreciated.
<script type="text/ng-template" id="home.html"> <h1>Blog</h1> </script><script src="app.js"></script>templateUrl: "../home.html"(look one folder behind for index.html) can you try this? with app.js inside the JS folder also<script src="js/app.js"></script>change this in index.html