@types
.npm install @types/node --save-dev
. И в tsconfig.json:{
"compilerOptions": {
"types": ["node"]
}
}
$.ajax({
url: this.url + this.currentPage,
type: `GET`,
/*... more params */
}).done(this.onRequest);
$.ajax({
url: this.url + this.currentPage,
type: `GET`,
/*... more params */
}).done(data => this.onRequest(data))
.filter((event: Event) => event instanceof NavigationEnd).subscribe(....)
@NgModule({
providers: [
{
provide: BetterHttp ,
useFactory: (xhrBackend: XHRBackend, requestOptions: RequestOptions) => {
return new SecurityHttp(xhrBackend, requestOptions, authService, router);
},
deps: [XHRBackend, RequestOptions]
},
{
provide: Http,
useExisting: BetterHttp,
}
]
})
export class CModule {
}
SystemJS.config({
"defaultJSExtensions": true,
map: {
css: '/js/system-css.js',
datepicker: 'js/datepicker.js'
},
meta: {
'*.css': { loader: 'css' }
},
baseURL: '/',
paths: {
jquery: 'js/jquery',
scrollbar: 'js/scrollbar'
}
});
@Component({
selector: 'my-component'
})
export class MyComponent {
@Input()
shown: boolean;
@Output()
shownChange = new EventEmitter<boolean>();
onClick():void {
this.shown = false;
this.shownChange.emit(this.shown);
}
}
<my-component [(shown)]="property"></my-component>
Collector.of(
TreeMap::new,
(map, e) -> map.put(e.getKey, e.getValue()),
(left, right) -> {left.putAll(right); return left;}
EnumSet.of(Collector.Characteristics.UNORDERED, Collector.Characteristics.IDENTITY_FINISH))
NavigableMap<Integer, Items> result = new TreeMap<>();
...forEach(e -> result.put(e.getKey(), e.getValue())
interface ParentStateItem {
id: number;
title: text;
}
interface ParentState {
items: ParentStateItem[];
}
class Parent extends React.Component<{}, ParentState> {
}
@Component({
templateUrl: 'your-smarty-template.php'
})
@Component({
template: '<div [innerHTML]="myHtml"></div>'
})
export class MyComponent implements OnInit {
myHtml?: SafeHtml;
constructor(private _http: Http, private _sanitizer: DomSanitizer) {
}
ngOnInit() {
this._http.get("your-smarty-template.php")
.subscribe(response =>
this.myHtml = this._sanitizer.bypassSecurityTrustHtml(response.text()));
}
}