0

Here my html-

     <p  ng-if= "editMode=='edit'" style="margin-left: 1px;margin-top: -2px;">===some messages---</p>
     <p  ng-if= "editMode=='addNew'" style="margin-left: 1px;margin-top: -2px;">===some messages---</p>

In above example i have two diffrent view "edit" and "addNew" with same content but style is different. How to do that?

JOGO
  • 285
  • 2
  • 7
  • 16

1 Answers1

0

You can use ng-class:

<p ng-class='{"class1": editMode=="edit", "class2": editMode=="addNew"}'>===some messages---</p>

And in css file:

.class1 {
     /* some styles */
}
.class2 {
     /* some styles */
}

However there are many more built in directives in AngularJS that you can use. For a more detailed explanation about the options available and with examples, take a look at the accepted answer for a similar question

Community
  • 1
  • 1
pgrodrigues
  • 2,083
  • 1
  • 24
  • 28