Angular2 Switch页面,无需单击router-link

时间:2015-11-06 14:44:59

标签: javascript angular

是否可以在不必单击[router-link] =“”html元素的情况下切换页面?

编辑:更新了正在运行的代码

import {Component, View} from 'angular2/angular2';
import {Router} from 'angular2/router';

@Component({
  selector: 'menu'
})
@View({
  templateUrl: '/views/menu.html',
  directives: []
})
export class Menu {

  constructor(public router: Router) {
  }

  navigate() { // Called by (click)= on element in .html
    this.router.navigate(['/Net_int_config']);
  }

}

0 个答案:

没有答案