Hey guys,
I am a newcomer to angular and am trying to learn the framework. I am
trying to create a custom filter, that takes the first character in a
string. When I pass it into an expression, I get the expression rendered
itself.
Here is my app.js
angular.module("my-app", [])
.controller("HomeCtrl", function($scope) {
})
.filter('first', function(string) {
return string.charAt(0);
});
index.html
<p>{{"abcde" | first }}</p>
I expected it to return "a", but it instead returned "{{"abcde" || first}}"
Here is my plunker.
http://plnkr.co/edit/re40GAAB8NYFdrGBSTlk?p=preview
Any help is appreciated.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.