Struggling to implement a lowercase pipe in angular2 and encountering syntax errors with ';'
syntax errors got ';'
app/lowercase.ts
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({ name: 'lowercase1'})
export class LowerCasePipe1 implements PipeTransform {
transform (value: string): string {
if (!value) return value;
if (typeof value !== 'string'){
throw new Error('Invalid pipe value: ', value);
}
return value.toLowerCase();
}
}
app/app.component.ts
import {Component} from '@angular/core';
import {LowerCasePipe1} from './lowercase';
@Component({
selector: 'app',
pipes: [LowerCasePipe1],
template: '<h1>{{"SAMPLE" | lowercase1 }} </h1>'
})
export class App {
console.info('lower case app')
}
app/index.ts
import {bootstrap} from '@angular/platform-browser-dynamic';
import {App} from './app.component';
//
bootstrap(App)
Check out the plunkr sample for implementation details: http://plnkr.co/edit/coB5AGWvpihUvCnBtX9D?p=preview