1
if (url.indexOf('master/confirm-account') > 0) {
    $scope.accountInfo = 'Confirm Account';
    $scope.page = 'confirm_account';
    $scope.activeTab = true;
} else if (url.indexOf('master/master-profile') > 0) {
    $scope.accountInfo = 'Confirm Account';
    $scope.page = 'master_profile';
    $scope.activeTab = true;
} else {
    $scope.accountInfo = 'Create Account';
}


<div ng-class = "{'process-step' : true, '({{page}}=='confirm_account') ? 'active-tab' : ' '}" >

How can I add process-step and active-tab class Expected result if condition match then it become like that

2

2 Answers 2

1

The ng-class works like

{'add_this_class' : (if_this_expression_is_true)}

and not in the other way.

try this

<div class="process-step" ng-class="{'active-tab' : (page =='confirm_account') }">
Sign up to request clarification or add additional context in comments.

Comments

0

Seeing to the complexity of your class matching logic you could go for second way of implementing ng-class

** Inside HTML**

<div class="process-step" ng-class="ctrl.getPageBasedClass()">

Inside Controller

var self.getPageBasedClass = function(){

   var yourClassNameAsString = // your logic for class name 
   return yourClassNameAsString;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.