Do ng-show="result.resultId.indexOf('One') == 0", etc.
A simple way to do this is to add a new method to your scope.
$scope.startsWith = function (actual, expected) {
var lowerStr = (actual + "").toLowerCase();
return lowerStr.indexOf(expected.toLowerCase()) === 0;
}
Then change the filter syntax on your element.
<ul border="1px" ng-repeat="msg in messages | filter:search:startsWith">
Here is a working plunkr with the example above.
Filter in object
$scope.fmyData = $filter('filter')($scope.AllMyData, $scope.filterOptions,function (actual, expected) {
return actual.toLowerCase().indexOf(expected.toLowerCase()) == 0;
});
Use startsWith method like this
<div *ngIf="name.startsWith('@')">
Show something
</div>
And if you want to check if string doesn't start with '@' simply add '!' like *ngIf="!name.startsWith('@')"
You can simply use indexOf method to get starting index of your character and if it's 0 it means it's true else false.
Like below.
<div *ngIf="name.indexOf('@name1') === 0">
it's start with @name1
</div>
<div *ngIf="name.indexOf('@name1') !== 0">
it's not start with @name1
</div>
Adding to what Eliseo has to say, I would also like to correct your existing use of pipe.
<div>{{ name | startsWith : 'Ang' }}</div>
<div *ngIf="( name | startsWith : 'Ang')"> Can see </div>
<div *ngIf="( name | startsWith : 'Test')"> Can't see </div>
Take a look at this demo code here
OR
<app-breadcrumb *ngIf="(url.startsWith('/register/'))"></app-breadcrumb>
Don't use pipe for such checks, its mostly for data transformation
A pipe is meant to transform the the input. As angular documentation states
A pipe takes in data as input and transforms it to a desired output.
You may simply use
<app-breadcrumb *ngIf="url.startsWith('register')"></app-breadcrumb>
Thanks.