ifUserInGroup
stormpath
Use this directive to conditionally show an element if the user is logged in and is a member of the group that is specified by the expression.
The attribute value MUST be one of:
Note: This feature depends on the data that is returned by the CURRENT_USER_URI. Your server should expand the account's groups before returning the user. If you are using express-stormpath, simply use Automatic Expansion
If using a string expression as the attribute value, you can pass a regular expression by wrapping it in the literal syntax, e.g.
'/admins/' would match any group which has admins in the name'/admin$/' would match any group were the name ends with adminIf referencing a scope property, you should create the value as a RegExp type, e.g.:
$scope.matchGroup = new RegExp(/admins/);
All regular expressions are evaluated via RegExp.prototype.test
<ANY if-user-in-group> ... </ANY>
<script type="text/javascript">
function SomeController($scope){
$scope.matchGroup = /admins/;
}
<script>
<div ng-controller="SomeController">
<h3 if-user-in-group="'admins'">
Hello, {{user.fullName}}, you are an administrator
</h3>
<div if-user-in-group="'/admins/'">
<!-- would match any group which has *admins* in the name -->
</div>
<div if-user-in-group="matchGroup">
<!-- equivalent to the last example -->
</div>
<div if-user-in-group="'/admin$/'">
<!-- would match any group were the name **ends with** *admin* -->
</div>
</div>