providers: [
GlobalService,
{
provide: APP_INITIALIZER,
useFactory: (service: GlobalService) => () => service.init(),
deps: [GlobalService], multi: true
}
],
@Injectable()
export class GlobalService {
data: any;
constructor(private http: Http) { }
init(): Promise<any> {
var promise = this.http.get('src/data.json').map(res => res.json()).toPromise();
promise.then(data => this.data = data);
return promise;
}
}
export class AppComponent {
constructor(private service: GlobalService) {
console.log(service.data);
}
}
article.post>.__header+.__content+.__footer|bem|jade
article.post
.post__header
.post__content
.post__footer
Preferences -> Package settings -> Emmet -> Settings - User
{
"syntaxProfiles": {
"html" : {
"filters" : "html, bem"
}
},
"preferences": {
"bem.elementSeparator":"__",
"bem.modifierSeparator":"--",
"bem.shortElementPrefix":"-"
}
}
As of jQuery 1.9, all the handlers for the jQuery global Ajax events, including those added with the .ajaxStart() method, must be attached to document.https://api.jquery.com/ajaxStart/
var maps = {};
maps["marker" + 0] = ...;
maps["marker" + 1] = ...;
for (var prop in maps) {
console.log(maps[prop]);
}