4-6的19分时,修改股票星级后,点击save,可以返回股票信息管理界面,但是马上要自动刷新一次,但是老师视频里却没有刷新。
来源:4-6 改造项目

慕粉5925852
2018-06-28
stock-form.componnent.ts代码
export class StockFormComponent implements OnInit {
stock:Stock;
constructor(private routeInfo:ActivatedRoute,private stockService:StockService,private router:Router) { }
ngOnInit() {
let stockId = this.routeInfo.snapshot.params['id'];
this.stock = this.stockService.getStock(stockId);
}
cancel(){
this.router.navigateByUrl("/stock");
}
save(){
this.router.navigateByUrl("/stock");
}
}
stock-form.component.html代码:
</div>
</div>
<!-- /.box-body -->
<div class="box-footer">
<button (click)="cancel()" type="submit" class="btn btn-default">取消</button>
<button (click)="save()" type="submit" class="btn btn-info pull-right">保存</button>
</div>
<!-- /.box-footer -->
</form>
</div>
卡在这个问题上好几天了,请老师帮我看看,谢谢!
2回答
-
把button换成a试下
222018-08-01 -
木讷25
2018-07-03
const routeConfig: Routes = [
{path:'', redirectTo: '/dashboard', pathMatch: 'full'},
{path: 'dashboard', component: DashboardComponent},
{path: 'stock', component: StockManageComponent},
{path: 'stock/:id', component: StockFormComponent},
]
你的路由配置对吗?
012018-07-03
相似问题