tubería angular primera letra mayúscula
{{ value_expression | titlecase }}
Victorious Vendace
{{ value_expression | titlecase }}
content_copy
@Component({
selector: 'titlecase-pipe',
template: `<div>
<p>{{'some string' | titlecase}}</p> <!-- output is expected to be "Some String" -->
<p>{{'tHIs is mIXeD CaSe' | titlecase}}</p> <!-- output is expected to be "This Is Mixed Case" -->
<p>{{'it\\'s non-trivial question' | titlecase}}</p> <!-- output is expected to be "It's Non-trivial Question" -->
<p>{{'one,two,three' | titlecase}}</p> <!-- output is expected to be "One,two,three" -->
<p>{{'true|false' | titlecase}}</p> <!-- output is expected to be "True|false" -->
<p>{{'foo-vs-bar' | titlecase}}</p> <!-- output is expected to be "Foo-vs-bar" -->
</div>`
})
export class TitleCasePipeComponent {
}
transform(value:string): string {
let first = value.substr(0,1).toUpperCase();
return first + value.substr(1);
}
app.filter('capitalize', function() {
return function(token) {
return token.charAt(0).toUpperCase() + token.slice(1);
}
});