javascript - Angular JS no-repeat with background images not working -



javascript - Angular JS no-repeat with background images not working -

i'm new angular.js (more of css/jquery guy) , can't work out why ng-repeat isn't working; i've done video tutorials on codeschool , thought had basics behind angular -down- but... isn't repeating. @ all. in fact, none of angular commands thought work are. can't ng-href update, can't ng-style style, , it's mess. there issue when applying static styles angular elements don't know about? have royally screwed something?

here's jsfiddle of causing me much grief:

http://jsfiddle.net/8s8vcdxr/6/

here's html i'm using, , rest on over fiddle:

<div ng-app="thiswebsite"> <div class="column" ng-controller="mycontroller control"> <section class="links" ng-repeat="instance in control.instances" ng-style="'background':'url(' + {instance.imageurl} + ') no-repeat;'"> <a ng-href="{{instance.pagelink}}"> <div class="link_overlay"> {{instance.title}} </div> </a> </section> </div> </div>

where going wrong?

there couple of things wrong main problem scripts aren't loading in right order.

change 'onload' 'no warp - in ' , you'll see new errors.

you should move this.instances = pieces; below define pieces.

then there's error in ng-style , can utilize style.

i corrected fiddle: http://jsfiddle.net/8s8vcdxr/8/

html

<div ng-app="thiswebsite"> <div class="column" ng-controller="mycontroller control"> <div class="links" ng-repeat="instance in control.instances" style="background: url({{instance.imageurl}}) no-repeat;"> <a ng-href="{{instance.pagelink}}"> <div class="link_overlay"> {{instance.title}}</div> </a> </div> </div> </div>

javascript

angular.module('thiswebsite', []) .controller('mycontroller', function () { var pieces = [{ pagelink: 'http://www.google.com', imageurl: 'http://scitechdaily.com/images/hubble-space-telescope-image-of-spiral-galaxy-messier-77-120x120.jpg', title: 'monster truck' }, { pagelink: 'http://www.yahoo.com', imageurl: 'http://scitechdaily.com/images/new-image-of-the-helix-nebula-120x120.jpg', title: 'not google' }, { pagelink: 'http://www.stackoverflow.com', imageurl: 'http://www.eva.mpg.de/neandertal/press/presskit-neandertal/images/image8_thumb.jpg', title: 'help please' }, { pagelink: 'http://jsfiddle.net', imageurl: 'http://scitechdaily.com/images/hubble-space-telescope-image-of-spiral-galaxy-messier-77-120x120.jpg', title: 'why no work' }]; this.instances = pieces; });

you should seek using debugger in browser. help lot, check out!

javascript html css angularjs

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -