Benjamin Benjamin - 1 month ago 8x
AngularJS Question

UI-view not rendering in AngularJS tutorial

I am trying to follow a tutorial from Dunebook.

I've gotten stuck as the UI-view is not rendering (I am checking it is rendering as specified in the page I link to right above "Adding Animations to the view transitions"). I've looked this over a few times and i'm not sure what I am doing wrong...

The code.


"name": "angular-seed",
"description": "A starter project for AngularJS",
"version": "0.0.0",
"homepage": "",
"license": "MIT",
"private": true,
"dependencies": {
"angular": "1.2.x",
"angular-ui-router": "",
"angular-animate": "1.2.x",
"angular-facebook": "",
"angular-loader": "1.2.x",
"angular-mocks": "~1.2.x",
"html5-boilerplate": "~4.3.0"


<!DOCTYPE html>

<!--[if lt IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="en" ng-app="myApp" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en" ng-app="myApp" class="no-js"> <!--<![endif]-->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>AngularJS tutorial</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="bower_components/html5-boilerplate/css/normalize.css">
<link rel="stylesheet" href="bower_components/html5-boilerplate/css/main.css">
<link rel="stylesheet" href="css/app.css"/>
<link rel="stylesheet" href="//"/>
<script src="bower_components/html5-boilerplate/js/vendor/modernizr-2.6.2.min.js"></script>
<div class="container">
<a class="navbar-brand" href="/">Garage Commerce</a>
<ul class="nav navbar-nav">
<li><a href="#/toys">Toys</a></li>
<li><a href="#/books">Books</a></li>

<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="">upgrade your browser</a> to improve your experience.</p>
<div class="container-fluid">
<div ui-view></div>

<!-- In production use:
<script src="//"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-ui-router/release/angular-ui-router.js"></script>
<script src="js/app.js"></script>
<script src="js/services.js"></script>
<script src="js/controllers.js"></script>
<script src="js/filters.js"></script>
<script src="js/directives.js"></script>


'use strict';

// Declare app level module which depends on filters, and services
angular.module('myApp', [
function($stateProvider) {
$stateProvider.state('add', {
templateUrl: 'partials/add-products.html',
controller: 'AddProductsCtrl'
$stateProvider.state('category', {
templateUrl: 'partials/products.html',
controller: 'ProductsCtrl'
$stateProvider.state('category.products', {
templateUrl: 'partials/products.details.html',
controller: 'ProductDetailsCtrl'


'use strict';

/* Controllers */

angular.module('myApp.controllers', []).controller('ProductsCtrl', ['$scope', '$stateParams',
function($scope, $stateParams) {
$scope.category = $stateParams.category
$scope.productsListing = [{
product_id: '123',
title: ' Baby Rattles',
price: 2,
userName: 'John Doe'
}, {
product_id: '456',
title: ' Kiddy Laptop',
price: 12,
userName: 'Sandy Peters'


.controller('ProductDetailsCtrl', ['$scope', '$stateParams',function($scope, $stateParams) {
$ = $;
$scope.product = {
'title': 'Kiddy Laptop',
'description': 'lorem lipsum do re me.',
'price': 12,
'userName': 'Sandy Peters'




<!-- 1st Column -->
<div class="col-md-5">
<div class="row-fluid listing sidebar" >
<div class="listing" ng-repeat="product in productsListing">

<h2><a ng-href="#/{{category%20+'/'+product.product_id}}">{{product.title}}</a> </h2>

<h5>{{product.price |currency}}</h5>



<!-- 2nd Column -->
<div class="col-md-7">
<div class="slide" ui-view></div>


<p class="title">{{id}}</p>

It all appears fairly identical to the tutorial. I'm confused and feeling pretty dumb.


If this is your exact code, you are missing a . between your module definition and calling config.

angular.module('myApp', [...])
    function($stateProvider) {

instead of

angular.module('myApp', [...])
    function($stateProvider) {

It actually makes sense that this is the issue, as your ui-view is not working would be caused by the lack of state definitions.