I want to change my classe for an element but I don\'t know how to process with Ionic 2. I tried this way but it\'s wrong :
You have to mention the class name first followed by the condition
<span [ngClass]="{'class1 class2' : (user.id == this.session.userDefaultId), 'class3 class4':(user.id != this.session.userDefaultId)}">
...
</span>
try this
<span [class.class1]="user.id == this.session.userDefaultId" [class.class2]="user.id == this.session.userDefaultId" [class.class3]="user.id != this.session.userDefaultId" [class.class4]="user.id != this.session.userDefaultId">
You can use a simple ternary operator to set the class for your example.
<span [ngClass]="(user.id == this.session.userDefaultId) ? 'class1 class2' : 'class3 class4'">
...
</span>