As Daniel mentioned a plunkr would be very helpful.

I'd add that firs thing I'd check is whether organCover is declared on the 
same scope that the header tag is at AND if it is declated as such:

> $scope.organCover = {
> 'background-image': "url('
> http://localhost/dooleystand/ci/public/images/organs/2/profile_pic.jpg')"
> }


If it is declared on a parent scope of the scope that the header tag is 
located at, then what you need is to have it as a child of another object.
Rule of thumb is that while using a property of a scope that is inherited - 
ALWAYS make sure there's a dot.

So your code would be:

HTML

>  <header class="orgWall" ng-style="styles.organCover"></header>


Parent Scope:

> $scope.styles {

  organCover: {

    'background-image': "url('
> http://localhost/dooleystand/ci/public/images/organs/2/profile_pic.jpg')"

  } 

}


On Monday, January 6, 2014 10:43:35 PM UTC+2, Allen Nie wrote:
>
> Well, this is what I get if I use ng-style="organCover":
>
> <header class="orgWall" ng-style="organCover"></header>
>
> It didn't translate organCover into the line of code that I hoped for, nor 
> did it add the background-image to element.style{} css.
>
> It's always kind of painful when situation happens like this and you have 
> no clue.
>
> On Monday, January 6, 2014 2:21:06 AM UTC-5, Sander Elias wrote:
>>
>> Hi Allen,
>>
>> Have a look at this 
>> <http://plnkr.co/edit/0kFL0jmawNCiN35R3Hzv?p=preview>plunk, it works as it 
>> should.
>> you have used ng-style="{{organCover}}" this means that your expression 
>> is translated into the
>> string {'background-image': \"url('
>> http://localhost/dooleystand/ci/public/images/organs/2/profile_pic.jpg'
>> )\"}
>>
>> as documented ng-style needs an object, not a string.
>>
>> so this should work for you: <header class="orgWall" 
>> ng-style="organCover"></header>
>>
>> regards
>> Sander
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to