我试图从url获取startdate.网址看起来像http:// sitename/booking?startdate = 28-08-2017 下面是我的代码
aap.module.ts
import {...};
@NgModule({
declarations: [
AppComponent, ModalComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
JsonpModule,
ReactiveFormsModule,
RouterModule.forRoot([{
path: '',
component: AppComponent
},
]),
],
providers: [ContactService, AddonService, MainService],
bootstrap: [AppComponent]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)
aap.component.ts
import {...}
import {Router, ActivatedRoute, Params} from '@angular/router';
constructor(private activatedRoute: ActivatedRoute) {
// subscribe to router event
this.activatedRoute.queryParams.subscribe((params: Params) => {
console.log(params);
});
}
Run Code Online (Sandbox Code Playgroud)
它通过以下错误给出
未处理的承诺拒绝:没有基本的href设置.请提供APP_BASE_HREF标记的值或向文档添加基本元素.; 区域:; 任务:Promise.then; 值:错误:没有设置基本href.请提供APP_BASE_HREF标记的值或向文档添加基本元素.
角度应该如何知道基础href?
我有一份工作,其中有两个转换.
转换获取传递给另一个转换的数据列表.这里它执行第一次转换的每一行传递.
在我用过的第二次转换中
"从结果中获取行" - >"表输入"
在"从结果中获取行"中有五个字段但在表输入中我只需要使用第2个位置和第3个位置字段.
即使我试图给单个参数"?" 它给出错误
"2017/06/29 15:11:02 - 从table.0获取数据 - 在准备好的声明上设置值#3 [String]错误2017/06/29 15:11:02 - 从table.0获取数据 - 参数索引超出范围(3>参数数量,即2)."
我的查询非常简单select*from table where col1 =?和col2 =?
我怎样才能做到这一点?错误?我做错了吗?