Angular error [$injector:modulerr] - injector nomod [closed] - angularjs

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I have just created module and controller for my functionality and got following error:
Error: [$injector:modulerr]
http://errors.angularjs.org/1.4.8/$injector/modulerr?p0=ContactsApp&p1=%5B%24injector%3Anomod%5D%
Following is my html code:
<div ng-app="ContactsApp" class="container">
<div class="row" ng-controller="contactsCtrl">
<div class="col-sm-12 padding-0"> <h2 class="text-center"> Contacts</h2>
<div class="panel panel-default">
<div class="panel-heading c-list">
<span class="title">Contacts</span>
<div class="pull-right">
<a data-toggle="modal" data-target="#upload-contacts" href="#upload-contacts" data-placement="top" title="Add Contact">
<span class="title "><i class="glyphicon glyphicon-plus"></i>Add</span>
</a>
</div>
</div>
</div>
<div>
<!-- My contacts page -->
{% if contributors.details or importedContacts.details%}
{% if not role %}
{% include 'mpb/mycontacts/mycontacts_contributed_team.html' %}
{% else%}
{% include 'mpb/mycontacts/mycontacts_contributors_rolewise.html' %}
{% endif %}
{% elif not contributors.details and not importedContacts.details %}
<div class="no-contacts">
<h3 class="no-contacts-text">No Contacts to show</h3>
</div>
{% endif %}
</div>
</div>
</div>
<div id="upload-contacts" class="modal fade bs-example-modal-sm" tabindex="1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content bg-modal">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title text-center" id="mySmallModalLabel">Import your contacts <i class="glyphicon glyphicon-question-sign" rel="tooltip" title="click for help."></i></h4>
</div>
<div class="modal-body">
<!--upload your contacts-->
<div id="dvImportSegments" class="fileupload ">
<div class="btn btn-primary btn-block image-preview-input">
<span class=" glyphicon glyphicon-folder-open"></span>
<span class="image-preview-input-title">Import Contacts</span>
<input type="file" id="contactFileUpload" accept=".csv .vCard" name="File Upload"/> <!-- rename it -->
</div>
</div><!--end of upload your contacts--><br>
</div>
</div>
</div>
</div>
</div>
Below is js code:
mycontacts.js
var app = angular.module('contactsApp', ['djangular-confirm', 'djangular-alert'])
.config(function ($httpProvider, $interpolateProvider) {
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
$httpProvider.defaults.headers.common['X-CSRFToken'] = '{$ csrf_value $}';
$interpolateProvider.startSymbol('{$');
$interpolateProvider.endSymbol('$}');
});
app.controller('contactsCtrl', function ($scope, $http, $location, $djconfirm, $djalert) {
});
files I have included
<script type="text/javascript" src="/js/jquery-1.11.0.min.js"></script>
<script src="/js/bootstrap.js"></script>
<script type="text/javascript" src="/js/angular.min.js"></script>
<script src="/djangular/js/django-angular.min.js" type="text/javascript"></script>
<script type="text/javascript" src="/js/angular-route.min.js"></script>

The error is showing that there is no module named ContactsApp which is what is expected as main app module due to your ng-app value.
You registered contactsApp which is not the same due to case sensitivity.
In other words: ContactsApp != contactsApp

Related

add jquery counterup plugin to symfony 2 with assetic

I'm trying to add a counter up effect to my home page in a symfony 2 application with angular . i have added dependencies in my config.yml file like this :
counter:
inputs:
- "bundles/ubidelectricity/js/custom/waypoints.min.js"
- "bundles/ubidelectricity/js/custom/jquery.counterup.min.js"
and i have called counter in my twig like this :
{% block javascripts %}
{% javascripts
'#jquery'
'#bootstrap_4_js'
'#jqueryui'
'#elfinder'
'#fastclick'
'#angular'
'#angular_storage'
'#angular_table'
'#angular_translate'
'#angular_scroll'
'#angular_file_uplaod'
'#angular_dynamic_locale'
'#bootstrap_colorpicker'
'#videogular'
'#oclazyload'
'#breadcrumb'
'#ui_bootstrap'
'#loading_bar'
'#color_picker'
'#locationpicker'
'#multirange_slider'
'#site_front_scripts'
'#continuous_net_services'
'#continuous_net_directives'
'#site_front_controller' %}<script src="{{ asset_url }}"></script>
{% endjavascripts %}
{% endblock %}
and i have added html in the front page like this :
<div class="row pt-5 pb-5">
<div class="col-md-3 text-center">
<span class="counter">3300</span> <span class="counters">+</span>
<span class="counter-text">Buyers Organisations</span>
</div>
<div class="col-md-3 text-center">
<span class="counter">585</span>
<span class="counter-text">Buyer Partners</span>
</div>
<div class="col-md-3 text-center">
<span class="counter">41000</span> <span class="counters">+</span>
<span class="counter-text">Tenders / Quotes </span>
<span class="counter-text"> Every Year </span>
</div>
<div class="col-md-3 text-center">
<span class="counter">658</span>
<span class="counter-text">Industry Categories</span>
</div>
</div>
I use :
php app/console assets:install
php app/console assetic:dump
php app/console assetic:watch
but it doesn't work and there are no animations.

Dynamically bind click event to button in template-url source

I am using ui-bootstrap angularjs for generating slide down's and added a button and click event, with alert message in controller but I don't get any alert or console log.
I am facing problem in generating alert on click of button which is being loaded using template-url as you can see in code below. I am sharing my sample code below.
angular.module('ui.bootstrap.demo', [ 'ui.bootstrap']);
angular.module('ui.bootstrap.demo').controller('AccordionDemoCtrl', function ($scope) {
console.log("CTRL LOADED");
$scope.alertMsg = function(){
alert('hejd');
}
});
<!doctype html>
<html ng-app="ui.bootstrap.demo">
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular-animate.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.5.8/angular-sanitize.js"></script>
<script src="//angular-ui.github.io/bootstrap/ui-bootstrap-tpls-2.2.0.js"></script>
<script src="example.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div ng-controller="AccordionDemoCtrl">
<script type="text/ng-template" id="group-template.html">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title" style="color:#fa39c3">
<button ng-click="alertMsg()">Btn</button>
<a href tabindex="0" class="accordion-toggle" ng-click="toggleOpen()" uib-accordion-transclude="heading">
<span uib-accordion-header ng-class="{'text-muted': isDisabled}">
{{heading}}
</span>
</a>
</h4>
</div>
<div class="panel-collapse collapse" uib-collapse="!isOpen">
<div class="panel-body" style="text-align: right" ng-transclude></div>
</div>
</div>
</script>
<uib-accordion close-others="oneAtATime">
<div uib-accordion-group class="panel-default" is-open="status.isCustomHeaderOpen" template-url="group-template.html">
<uib-accordion-heading>
Custom template with custom header template <i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': status.isCustomHeaderOpen, 'glyphicon-chevron-right': !status.isCustomHeaderOpen}"></i>
</uib-accordion-heading>
World
</div>
</uib-accordion>
</div>
</body>
</html>
I do get the log "CTRL LOADED". But I am not getting alert message when I click.
I believe the panel creates its own scope so you need to call the parent scope to get the alert message like so:
<div ng-controller="AccordionDemoCtrl">
<script type="text/ng-template" id="group-template.html">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title" style="color:#fa39c3">
<button ng-click="$parent.alertMsg()">Btn</button>
<a href tabindex="0" class="accordion-toggle" ng-click="toggleOpen()" uib-accordion-transclude="heading">
<span uib-accordion-header ng-class="{'text-muted': isDisabled}">
{{heading}}
</span>
</a>
</h4>
</div>
<div class="panel-collapse collapse" uib-collapse="!isOpen">
<div class="panel-body" style="text-align: right" ng-transclude></div>
</div>
</div>
</script>
Here is a Plunker

Display comments in comment box with AngularJS - ng-repeat inside another ng-repeat using API JSON data

I'm simply trying to display comments that users put within a comment box. However, I'm having issues because it's within an ng-repeat directive. Let me show so you can better understand visually:
<!DOCTYPE html>
<html lang="en" ng-app="MyApp">
<head>
<meta charset="UTF-8">
<title>Nuvi Interview Code Project</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="stylesheet.css">
</head>
<body ng-controller="HomeController">
<div class="container-fluid">
<h1>Nuvi Interview Code Project</h1>
<form class="form-inline well well-sm clearfix">
<span class="glyphicon glyphicon-search"></span>
<input type="text" placeholder="Search" class="form-control" ng-model="search">
</form>
<div class="row">
<div class="col-sm-6" ng-repeat="actor in data | filter:search">
<div class="well well-sm">
<div class="row">
<div class="col-md-6">
<img ng-src="{{actor.actor_avator}}" class="img-rounded img-responsive well-image pull-left">
<h3 class="name" data-toggle="modal" data-target="#actor-info" ng-click="changeActiveActor(actor)">{{actor.actor_name}}</h3>
<hr>
<p ng-repeat="say in activity_comments">{{say}}</p>
<div>{{actor.activity_comments}} Comments {{actor.activity_likes}} likes {{actor.activity_shares}} shares</div>
<br>
<input type="text" class="form-control" placeholder="Write a comment..." ng-model="comment">
<button class="btn btn-default" ng-click="postComment($index, comment)">Post Comment</button>
</div>
<div class="col-md-6">
<p class="pull-right"><strong>{{actor.provider}} </strong></p>
<p><strong>Post</strong></p>
<h5>{{actor.activity_message}}</h5>
<br><br><br><br><br>
<button ng-click="countUp($index)" type="button" class="btn btn-default btn-sm">
<span class="glyphicon glyphicon-thumbs-up"></span> Like
</button>
<button ng-click="countDown($index)" type="button" class="btn btn-default btn-sm">
<span class="glyphicon glyphicon-thumbs-down"></span> Unlike
</button>
</div>
</div>
</div>
</div>
</div>
<div class="modal" id="actor-info">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h2>{{activeActor.actor_name}}</h2>
</div>
<div class="modal-body">
<div class="row">
<div class="col-xs-8 col-xs-offset-2">
<img ng-src="{{activeActor.actor_avator}}" class="img-rounded img-responsive">
</div>
</div>
<div class="row top-buffer">
<div class="col-md-6">
<p>Message: {{activeActor.activity_message}}</p>
<p><strong>Username:</strong> {{activeActor.actor_username}}</p>
<p><strong>Date:</strong> {{activeActor.activity_date}}</p>
<p><strong>Comment:</strong> {{activeActor.activity_comments}}</p>
<p><strong>Likes:</strong> {{activeActor.activity_likes}}</p>
<p><strong>Sentiment:</strong> {{activeActor.activity_sentiment}}</p>
<p><strong>Shares:</strong> {{activeActor.activity_shares}}</p>
<p><strong>ID:</strong> {{activeActor.id}}</p>
<p><strong>Provider:</strong> {{activeActor.provider}}</p>
</div>
<div class="col-xs-12">
<p></p>
<button class="btn btn-danger pull-right" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- END OF MODAL -->
<hr>
<h6 class="pull-right">Coded by Saia Fonua</h6>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script src="app.js"></script>
</body>
</html>
Here is my app.js:
var app = angular.module("MyApp", []);
app.controller("HomeController", ["$scope", "$http", function($scope, $http) {
$scope.data = [];
$scope.search = "";
$scope.comment = "";
$scope.activeActor = {};
$scope.changeActiveActor = function(index) {
$scope.activeActor = index;
}
$scope.postComment = function(index, comment) {
console.log('comment ', comment);
//$scope.data[index].comments = [];
$scope.data[index].comments.push(comment);
console.log($scope.data[index]);
}
$scope.countUp = function(index) {
$scope.data[index].activity_likes++;
}
$scope.countDown = function(index) {
$scope.data[index].activity_likes--;
}
$http.get("https://nuvi-challenge.herokuapp.com/activities").then(function(response) {
console.log(response.data);
$scope.data = response.data;
})
}])
Can someone please help me to get the comments to display. When you start playing around with it, you'll see why it's harder than the problem sounds!
You have some problems with this line
<p ng-repeat="say in activity_comments">{{say}}</p>
As you are adding the comments to
$scope.data[index].comments.push(comment);
They would be reached by the actor.comments object
<p ng-repeat="say in actor.comments">{{say}}</p>

RSpec,Capybara,Poltergeist: Unable to find angular app content in test scenarios where ng-app defined on a div or Body instead of HTML tag

I am unable to get any content of page in Rspec test scenarios for ng-view or ui-view when ng-app defined on div or body instead of HTML tag. But in case ng-app is defined on HTML tag content, it is visible for ng-view.
capybara_config.rb
require 'capybara/rspec'
require 'capybara/poltergeist'
require_relative '../rack/rack_config'
Capybara.register_driver :poltergeist do |app|
options = {debug: false, js_errors: false, timeout: 180, phantomjs_logger: StringIO.new, logger: nil,
extensions: [File.expand_path("../../js_libraries/jquery.js", __FILE__), File.expand_path("../../js_libraries/jquery-ui.min.js", __FILE__),
File.expand_path("../../js_libraries/jquery-ui.min.css", __FILE__), File.expand_path("../../js_libraries/jquery-ui.theme.min.css", __FILE__)],
phantomjs_options: ['--load-images=no', '--ignore-ssl-errors=yes']}
Capybara::Poltergeist::Driver.new(app,options)
end
Capybara.javascript_driver = :poltergeist
Capybara.ignore_hidden_elements = false
Capybara.default_wait_time = 5
spec_helper.rb
require 'rspec/core'
RSpec.configure do |config|
config.include Capybara::DSL
end
angular_test_spec.rb
require 'spec_helper'
require_relative '../config/capybara/capybara_config'
describe "Employee Index Page UI content" , js: true do
it "employee index page " do
visit('https://app.employes.nl')
puts(page.body)
end
end
Gemfile
source 'https://rubygems.org'
gem "rspec"
gem "capybara"
gem "poltergeist"
On code inspect of app.employes.nl
<body ng-app="employeesApp" class="ng-scope"> <!-- uiView: --><ui-view class="ng-scope"><div class="container ng-scope"> <!-- uiView: --><ui-view class="ng-scope"><div class="container-small ng-scope"> <div class="panel panel-default"> <div class="panel-body"> <form class="form-signin ng-pristine ng-valid-email ng-invalid ng-invalid-required" ng-submit="login()"> <div class="row"> <div class="col-xs-12 text-center"> <img style="height: 2em" src="images/LogoEmployes.52a47633.png"> </div> </div> <hr> <label for="inputEmail" class="sr-only">Je emailadres</label> <input type="email" id="inputEmail" class="form-control ng-pristine ng-empty ng-valid-email ng-invalid ng-invalid-required ng-touched" placeholder="Je e-mailadres" ng-model="formData.email" required="" autofocus="" style=""> <label for="inputPassword" class="sr-only">Je wachtwoord</label> <input type="password" id="inputPassword" class="form-control ng-pristine ng-untouched ng-empty ng-invalid ng-invalid-required" placeholder="Je wachtwoord" ng-model="formData.password" required=""> <button class="btn btn-lg btn-primary btn-block" type="submit">Inloggen</button> </form> <p class="text-muted small text-center"> Nog geen account? | Wachtwoord vergeten? </p> </div> </div> </div></ui-view> </div> <footer class="footer ng-scope"> <div class="container"> <p class="text-center text-muted small"> © Employes B.V. 2016 | Heb je vragen? Neem contact met ons op. </p> </div> </footer> <!-- Contact modal--> <div class="modal fade ng-scope" id="help" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-dialog modal-sm"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel">Neem contact op</h4> </div> <div class="modal-body"> <div class="row"> <div class="col-md-12 text-center"> <p>Heb je vragen, bel of mail gerust!</p> Mail ons<br>of<br> Tel. 053-789 30 36 </div> </div> </div> <div class="modal-footer"> </div> </div> </div> </div></ui-view> <!-- Full page loader. --> <div class="pg-loading-screen pg-loading ng-hide" style="background-color: #E6E6E6" ng-show="isAppLoading"> <div class="pg-loading-inner"> <div class="pg-loading-center-outer"> <div class="pg-loading-center-middle"> <h1 class="pg-loading-logo-header"> <img style="height: 1.5em" class="pg-loading-logo" src="images/LogoEmployes.52a47633.png"> </h1> <div class="pg-loading-html pg-loaded"> <p class="loading-message"></p> <div class="sk-circle"> <div class="sk-circle1 sk-child"></div> <div class="sk-circle2 sk-child"></div> <div class="sk-circle3 sk-child"></div> <div class="sk-circle4 sk-child"></div> <div class="sk-circle5 sk-child"></div> <div class="sk-circle6 sk-child"></div> <div class="sk-circle7 sk-child"></div> <div class="sk-circle8 sk-child"></div> <div class="sk-circle9 sk-child"></div> <div class="sk-circle10 sk-child"></div> <div class="sk-circle11 sk-child"></div> <div class="sk-circle12 sk-child"></div> </div> </div> </div> </div> </div> </div> <script type="text/javascript" async="" src="https://widget.intercom.io/widget/{app_id}"></script><script src="https://drrjhlchpvi7e.cloudfront.net/libs/stamplay-js-sdk/1.3.3/stamplay.min.js"></script> <script src="scripts/vendor.11815825.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-i18n/1.5.0/angular-locale_nl-nl.js"></script> <script src="scripts/scripts.9367f845.js"></script> <!-- Snippet for Intercom.io --> <script type="text/javascript">(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;
s.src='https://widget.intercom.io/widget/{app_id}';
var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script> <iframe style="display: none;"></iframe></body>
But got following output on angular_test_spec.rb execution:
<body ng-app="employeesApp"> <ui-view></ui-view> <!-- Full page loader. --> <div class="pg-loading-screen pg-loading" style="background-color: #E6E6E6" ng-show="isAppLoading"> <div class="pg-loading-inner"> <div class="pg-loading-center-outer"> <div class="pg-loading-center-middle"> <h1 class="pg-loading-logo-header"> <img style="height: 1.5em" class="pg-loading-logo" src="images/LogoEmployes.52a47633.png"> </h1> <div class="pg-loading-html pg-loaded"> <p class="loading-message"></p> <div class="sk-circle"> <div class="sk-circle1 sk-child"></div> <div class="sk-circle2 sk-child"></div> <div class="sk-circle3 sk-child"></div> <div class="sk-circle4 sk-child"></div> <div class="sk-circle5 sk-child"></div> <div class="sk-circle6 sk-child"></div> <div class="sk-circle7 sk-child"></div> <div class="sk-circle8 sk-child"></div> <div class="sk-circle9 sk-child"></div> <div class="sk-circle10 sk-child"></div> <div class="sk-circle11 sk-child"></div> <div class="sk-circle12 sk-child"></div> </div> </div> </div> </div> </div> </div> <script type="text/javascript" async="" src="https://widget.intercom.io/widget/{app_id}"></script><script src="https://drrjhlchpvi7e.cloudfront.net/libs/stamplay-js-sdk/1.3.3/stamplay.min.js"></script> <script src="scripts/vendor.11815825.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-i18n/1.5.0/angular-locale_nl-nl.js"></script> <script src="scripts/scripts.9367f845.js"></script> <!-- Snippet for Intercom.io --> <script type="text/javascript">(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;
s.src='https://widget.intercom.io/widget/{app_id}';
var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script> </body>
As shown in the output of terminal ui-view don't have any content.
Don't know why this strange behavior occurs every time. So can any body please guide me how can I get ng-view content if ng-app is defined on body not as HTML tag?
Upgrade to PhantomJS 2.1+ which supports Function.prototype.bind() as required by Angular.

Service (factory) error - json api not displaying data

I have spent like a good 4 to 6 hours on trying to solve my issue - maybe I am looking at it completely wrong.
controller.js file:
'use strict';
/* Controllers */
var bookControllers = angular.module('bookControllers', []);
bookControllers.controller('BookListCtrl', ['$scope', 'Book',
function($scope, Book) {
$scope.books = Book.query();
$scope.orderProp = 'name';
}]);
bookControllers.controller('BookDetailCtrl', ['$scope', '$routeParams', 'Book',
function($scope, $routeParams, Book) {
$scope.book = Book.get({bookId: $routeParams.bookId}, function(book) {
$scope.mainImageUrl = book.avatar;
});
$scope.setImage = function(imageUrl) {
$scope.mainImageUrl = imageUrl;
};
}]);
My service.js file
'use strict';
/* Services */
var bookServices = angular.module('bookServices', ['ngResource']);
bookServices.factory('Book', ['$resource',
function($resource){
return $resource('https://api.myjson.com/bins/1oofv', {}, {
query: {method:'GET', params:{bookId:'bookId'}, isArray:true}
});
}]);
So what is happening.
My SHOW file - which displays all books within my book.json file which I have hosted on myjson displays all the content I need.
It displays all thumbnails accordingly with the following html:
<div class="container">
<!--Nav Bar-->
<div class="row">
<div class="col-md-4">
Find me the best
<select ng-model="orderProp" class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown">
<option value="name">Alphabetical</option>
<option value="age">Newest</option>
</select>
</div>
<div class="col-md-4">
Books about
<select ng-model="orderProp" class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown">
<option ng-repeat="book in books" value="">{{ book.genre.name }}</option>
</select>
</div>
<div class="col-md-4">
<div class="input-group">
<input ng-model="query" type="text" class="form-control" placeholder="Search books">
<span class="input-group-btn">
<button class="btn btn-default" type="button"><span class="glyphicon glyphicon-search" ></span></button>
</span>
</div>
</div>
</div>
<!--Body content-->
<div class="row">
<div class="col-md-4" ng-repeat="book in books | filter:query | orderBy:orderProp">
<div class="thumbnail" id="books">
<img ng-src="{{ book.cover }}">
<div class="caption">
<h4>{{ book.name }}</h4>
<h5>{{ book.author.name }}</h5>
<span class="glyphicon glyphicon-heart likes">{{ book.likes }}</span>
<span style="float: right;">{{ book.published | date:'yyyy-MM-dd' }}</span>
</div>
</div>
</div>
</div>
</div>
This is all fine - now when I click a specific book or author I am expecting the app to nav to the next page a detail ALL the details I need in the following template (but it doesn't):
<div class="container">
<div class="row">
<header>
<h1></h1>
<h4></h4>
<p></p>
<h6>Categories:</h6>
<span>{{ book.genre.category }}</span>
</header>
</div>
<div class="row">
<h3>Introduction</h3>
<h1></h1>
<p></p>
<div class="line-sep"></div>
<img ng-src="{{ avatar }}" class="img-round" />
<h2></h2>
</div>
<div class="row">
<h1>Similar reading</h1>
<p></p>
<div class="col-md-4">
<div class="thumbnail" id="books">
<img ng-src="http://placehold.it/350x500">
<div class="caption">
<h4>Lorem Ipsum Dolar Asar</h4>
<h5>By Mr Lorem Ipsum</h5>
<span class="glyphicon glyphicon-heart likes">1032</span>
<span style="float: right;">3 days ago</span>
</div>
</div>
</div>
<div class="col-md-4">
<div class="thumbnail" id="books">
<img ng-src="http://placehold.it/350x500">
<div class="caption">
<h4>Lorem Ipsum Dolar Asar</h4>
<h5>By Mr Lorem Ipsum</h5>
<span class="glyphicon glyphicon-heart likes">1032</span>
<span style="float: right;">3 days ago</span>
</div>
</div>
</div>
<div class="col-md-4">
<div class="thumbnail" id="books">
<img ng-src="http://placehold.it/350x500">
<div class="caption">
<h4>Lorem Ipsum Dolar Asar</h4>
<h5>By Mr Lorem Ipsum</h5>
<span class="glyphicon glyphicon-heart likes">1032</span>
<span style="float: right;">3 days ago</span>
</div>
</div>
</div>
</div>
</div>
Look at my josn file on the site: https://api.myjson.com/bins/1oofv
All I need to do is the following:
Use the json file to display the books (with some details) on the list page - in whatever display style I feel is appropriate.
Then - once all the books are displayed (with search and filter abilities) - be able to click on a book and be taken to a BOOK DETAIL page where we will delve into more detail about the book and show books that are similar to them.
stop stressing, and follow the Flatlander Gemstore tutorial.
First problem I could spot is, you use Book.get but defined Book.query
Secondly, using href="#" breaks angular, either use an <a href="">or, as I prefer, simply use a button, a hyperlink that goes nowhere isn't a link.
as yeouuu said, href="{{ book.id }}" seems wrong, this is either a semantical error and should be href="{{ book.url }}" or this is simply an error and should have been something else entirely.
Do the tutorial, it is a great resource.

Resources