Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

angular pipe to capitalize first letter

transform(value:string): string {
  let first = value.substr(0,1).toUpperCase();
  return first + value.substr(1); 
}
  
Comment

angular capitalize first letter

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 {
}
Comment

method for convert first letter in uppercase in angular

app.filter('capitalize', function() {
  return function(token) {
      return token.charAt(0).toUpperCase() + token.slice(1);
   }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: reset select option jquery 
Javascript :: javascript pre increment and post increment 
Javascript :: react render after data loaded 
Javascript :: uppercase in javascript 
Javascript :: response.json() promise pending 
Javascript :: difference between library and framework in javascript 
Javascript :: discord chatbot 
Javascript :: javascript list has item 
Javascript :: deploy vue js to shared hosting 
Javascript :: install stripe to react/nodejs - typescript 
Javascript :: poll in javascript 
Javascript :: react native create apk 
Javascript :: how to print in javascript 
Javascript :: jquery get 2 hours frmo now 
Javascript :: reset page js 
Javascript :: array shuffle 
Javascript :: input type email react js-validation 
Javascript :: generate a random number between min and max 
Javascript :: ISS proxy express 
Javascript :: javascript sum of arguments 
Javascript :: enzyme-adapter-react-17 
Javascript :: timeout 
Javascript :: spotify web player 
Javascript :: js dictionary to extract the same key bvalues 
Javascript :: string to regex javascript 
Javascript :: npm run build serve 
Javascript :: create directory when writing to file in nodejs 
Javascript :: a.reduce 
Javascript :: how to remove an object from an array javascript 
Javascript :: custom timestamp name mongoose 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =