yaboiduke yaboiduke - 10 months ago 89
AngularJS Question

Angular ng-class not working but regular class attribute works

I have this view template that is a child to another view.
The parent view of this view is a child to the

where I am importing my
index.html > other view > view below

When I try to change the
class = "bubble me"
below - which works fine ,to
ng-class = "bubble me"
my css is not loaded. Am I missing something? The issue is isolated to this view only.

<div class="top"><span>To: <span class="name">{{chat.name}}</span></span></div>
<div class="chat">
<div class="conversation-wrapper">

<div class="conversation-start">
<span>Today, 6:48 AM</span>
<div class="bubble me" ng-repeat = "message in sent_received">
<div class="write">
<a href="javascript:;" class="write-link attach"></a>
<input ng-model = "input.message" type="text" />
<a href="javascript:;" class="write-link smiley"></a>
<a ng-click= "sendMsg()" class="write-link send"></a>

Answer Source

does ng-class work only for conditional classes? I would like to combine my regular hard coded classes with the conditional ones so I dont have both a class attribute and an ng-class attribute in my tags..is there no way of doing this? - in the code above the bubble is not dynamic. I would like to make the me class only dynamic

This might work for your case.

ng-class="value=='true'?'bubble me':'bubble'"