w2olves w2olves - 12 days ago 4x
AngularJS Question

Why is this simple UI-Router example not working?

I feel guilty about asking such a question...Still, here goes
I have a fairly basic UI-Router example, however for the life of me I am not able to get it to work.

The body looks like this:

<nav class="navbar navbar-inverse">
<div class="container">
<a ui-sref="home" class="navbar-brand">My Product</a>
<div class="container">
<div ui-view></div>

The app. js module looks like this

//Module Declaration
var app = angular.module("movieViewer", ["ui.router"]);

app.config(["$stateProvider", "$urlRouterProvider",
function($stateProvider, $urlRouterProvider) {
.state("home", {
url: "/",
templateUrl: "main.html",
// controller: "MainCtrl",


Fairly simple, however it doesnt work. Will appreciate any heads up on this.

Plunk here


You need to kick off angular on page by adding ng-app directive with module name movieViewer on html tag.


Demo Here