javascript2016 javascript2016 - 1 year ago 70
AngularJS Question

Angular - Why won't my ui-view show my template html text?

I wonder why my template which I refer to in my angular state ('home') won't be shown - in my index.html I included a tag. Anyone knows?Thank you!


var app = angular.module('portfolio', ['ui.router']);


<body ng-app="portfolio">

<script src="angular.min.js"></script>
<script src=""></script>
<script src="js/app.js"></script>
<script src="js/home/home.js"></script>


app.config(function ($stateProvider) {
$stateProvider.state('home', {
url: '/',
templateUrl: '/browser/js/home/home.html'


<div><p>not working</p></div>

Answer Source

I think your router are not able to match / url. That's why you have to specify a default state, because not always your url will come with /.

Consider forcing a default state like so:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download