I’m brand new at AngularJS, watching a Lynda.com video series on it, “Up and Running with AngularJS with Ray Villalobos.” I can’t get past this error notice. I’m using WAMP to display an external Ajax file data.json with an $http service.
I don’t understand why my content is not displaying on the screen. All that shows onscreen is the CSS border for the div and the “Photo of” alt text. Nothing in the {{}}'s display. Once I started using the WAMP server, the content stopped appearing - the server is started, though. Here is the error:
"http://localhost/AngularJS/lib/angular/angular.min.js is being assigned a //# sourceMappingURL, but already has one"
GET http://localhost/AngularJS/images/.jpg
My controllers.js:
var nsMyApp = angular.module('myApp', []);
nsMyApp.controller('MyController', ['$scope', '$http', function($scope, $http) {
$http.get('js/data.json').success(function(data) {
$scope.flowers = data;
});
}]);
The index.html body:
<div ng-controller = "MyController"> <!-- ng-controller bootstraps an application -->
<div ng-repeat="item in flowers | limitTo: 4"> <!-- May need to add " track by &index" to remove "Error: [ngRepeat:dupes]" notice. limitTo prevented the list from repeating hundreds of times. -->
<div class="section">
<h2>{{item.model}}</h2>
<!-- Needed to chg <img src to <img ng-src -->
<img ng-src="images/{{item.shortname}}.jpg" width="200px" alt="Photo of {{item.model}}" title="Photo of {{item.model}}">
<h3>{{item.description}}</h3>
</div>
</div>
</div>
data.json:
var myApp = [
{
"model" : "Calla Lily",
"description" : "Amethyst Riches",
"shortname" : "calla"
},
{
"model" : "Rose",
"description" : "Red Rose Bouquet",
"shortname" : "rose"
},
{
"model" : "Orchid",
"description" : "Tickled Pink Orchid",
"shortname" : "orchid"
},
{
"model" : "Gerbera Daisy",
"description" : "Colorful World Gerbera Daisy",
"shortname" : "daisy"
}
]
Perhaps there is a setting in WAMP that is preventing this from working?