小编San*_*dhe的帖子

什么是package-info.java,如何将其添加到我的项目中?

当我在Spring项目上运行Checkstyle时,它说:

- Missing package-info.java file.
Run Code Online (Sandbox Code Playgroud)
  1. 什么是package-info.java,它有什么用?
  2. 我该如何处理这条消息?

java spring hibernate spring-mvc checkstyle

21
推荐指数
1
解决办法
2万
查看次数

Angular 2,从不为实现OnActivate的组件调用routerOnActivate方法

我正在尝试使用Angular 2路由器记录当前路由,使用官方文档中的示例代码:https://angular.io/docs/ts/latest/api/router/OnActivate-interface.html

import {Component} from 'angular2/core';
import {
    OnActivate,
    ComponentInstruction
} from 'angular2/router';


@Component({selector: 'header-title', template: `<div>routerOnActivate: {{log}}</div>`})
export class HeaderTitle implements OnActivate {
    log: string = '';

    routerOnActivate(next: ComponentInstruction, prev: ComponentInstruction) {
        console.log('hello on activate');
        this.log = `Finished navigating from "${prev ? prev.urlPath : 'null'}" to "${next.urlPath}"`;
    }
}
Run Code Online (Sandbox Code Playgroud)

routerOnActivate永远不会调用该方法.

我使用RouteConfig注释配置了路由:

@RouteConfig([
    {path: '/', component: Home, name: 'Index', data: {title: 'Index page'}},
    {path: '/home', component: Home, name: 'Home', data: {title: 'Welcome Home'}},
    {path: …
Run Code Online (Sandbox Code Playgroud)

angular2-routing angular

7
推荐指数
1
解决办法
6344
查看次数