请帮我在Angular2中做一个关于http with synchronous的例子?
我尝试如下:在组件中:
getAllAddress(){
this.addressService.getAllAddress().then(
result => {
this.data = result.list;
this.onChangeTable(this.config, null);
console.log('FIRST');
}
);
console.log('LAST');
}
Run Code Online (Sandbox Code Playgroud)
在服务中:
public getAllAddress(){
return this.__http.get('LOCATION')
.map((res) => {
return res.json()
})
.toPromise();
}
Run Code Online (Sandbox Code Playgroud)
但是控制台显示日志在'FIRST'之前是'最后'.
谢谢.
如何在tarantool cartridge不重新启动应用程序的情况下执行热重载代码?
需要为
表格的可能设计语言 实现COS aka MUMPS的语法突出显示
new (new,set,kill)
set kill=new
Run Code Online (Sandbox Code Playgroud)
其中:'new'和'set'是命令,也是变量
grammar cos;
Command_KILL :( ('k'|'K') | ( ('k'|'K')('i'|'I')('l'|'L')('l'|'L') ) );
Command_NEW :( ('n'|'N') | ( ('n'|'N')('e'|'E')('w'|'W') ) );
Command_SET :( ('s'|'S') | ( ('s'|'S')('e'|'E')('t'|'T') ) );
INT : [0-9]+;
ID : [a-zA-Z][a-zA-Z0-9]*;
Space: ' ';
Equal: '=';
newCommand
: Command_NEW Space ID
;
setCommand
: Command_SET Space ID Space* Equal Space* INT
;
Run Code Online (Sandbox Code Playgroud)
我有一个问题,当ID像名字一样命令(NEW,SET等)
我怎么能找到以前的/左令牌词法
例如
lexer grammar TLexer;
ID : [a-zA-Z] [a-zA-Z0-9]*;
CARET : '^';
RTN : {someCond1}? CARET ID; // CARET not include this token
GLB : {someCond2}? CARET ID; // CARET not include this token
Run Code Online (Sandbox Code Playgroud)
等等