There are several ways to achieve this.
html
<label for="name" ng-class="labelClass()" class="xs-keep-label-in-place">Display Name</label>
JS
$scope.labelClass = function(){
var classes = [];
if($scope.userProfile.name === null){
classes.push('custom-label-no-content');
}else{
classes.push('custom-label-content');
}
return classes;
}
2. Using an Expression with single curly brace
html
<label for="name" ng-class="{ 'custom-label-no-content': userProfile.name === null, 'custom-label-content': userProfile.name !== null }" class="xs-keep-label-in-place">Display Name</label>
3. Applying a Switch Statement with hardcoded class
html
<div class="col-md-12" ng-switch="userProfile.name === null">
<input type="text" name="name" id="name" class="input-border" ng-model="userProfile.name"/> {{userProfile.name}}
<label for="name" ng-switch-when="true" class="custom-label-no-content xs-keep-label-in-place">Display Name</label>
<label for="name" ng-switch-when="false" class="custom-label-content xs-keep-label-in-place">Display Name</label>
</div>
I personally recommend option 1 as it adheres to the MVC pattern, keeping logic in the controller and view code focused on display purposes.