How to reverse string in angular js
<div ng-controller="secondController">
<input type="text" ng-model="data.message">
<h1>{{data.message | toCaps | reverse }}</h1>
</div>
Update to UPPERCASE
myApp.filter('toCaps',function () {
return function (msg) {
return msg.toUpperCase();
}
});
UPDATE to reverse
myApp.filter('reverse',function () {
return function (msg) {
return msg.split("").reverse().join("");
}
});
<div ng-controller="secondController">
<input type="text" ng-model="data.message">
<h1>{{data.message | toCaps | reverse }}</h1>
</div>
Update to UPPERCASE
myApp.filter('toCaps',function () {
return function (msg) {
return msg.toUpperCase();
}
});
UPDATE to reverse
myApp.filter('reverse',function () {
return function (msg) {
return msg.split("").reverse().join("");
}
});
0 comments: