2017-02-20 3 views
1

내 앱에 페이지 매김을 도입하려고하지만 오류가 발생합니다. 나는 내 구성 요소의 필드 선언하는 방법이있다 ng2-bootstrap유형 '유형'이 일반이 아닙니다.

다음입니다 :

public bigTotalItems: number = IEmployee.length; 
public maxSize: number = 5; 

을 내가 템플릿을 사용하는 방법이 있습니다 : Heres는 내 app.module.ts

<pagination [totalItems]="bigTotalItems" [maxSize]="maxSize" class="pagination-sm" 
         [boundaryLinks]="true"></pagination> 

:

import { NgModule }  from '@angular/core'; 
import { BrowserModule } from '@angular/platform-browser'; 
import { FormsModule } from '@angular/forms'; 
import { AppComponent } from './app.component'; 
import { HttpModule } from '@angular/http'; 
import { PaginationModule } from 'ng2-bootstrap'; 

@NgModule({ 
    imports: [PaginationModule.forRoot(),BrowserModule, FormsModule, HttpModule ], 
    declarations: [AppComponent], 
    bootstrap: [AppComponent] 

}) 
export class AppModule { } 

component-loader.class.d.ts 파일에서이 오류가 발생합니다.

또한 내가 사용하고 종속성 버전을 공유 할 수 package.json를 부착 :

{ 
    "name": "angular2-quickstart", 
    "version": "1.0.0", 
    "description": "QuickStart package.json from the documentation, supplemented with testing support", 
    "scripts": { 
    "start": "tsc && concurrently \"tsc -w\" \"lite-server\" ", 
    "docker-build": "docker build -t ng2-quickstart .", 
    "docker": "npm run docker-build && docker run -it --rm -p 3000:3000 -p 3001:3001 ng2-quickstart", 
    "pree2e": "npm run webdriver:update", 
    "e2e": "tsc && concurrently \"http-server -s\" \"protractor protractor.config.js\" --kill-others --success first", 
    "lint": "tslint ./app/**/*.ts -t verbose", 
    "lite": "lite-server", 
    "postinstall": "typings install", 
    "test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"", 
    "test-once": "tsc && karma start karma.conf.js --single-run", 
    "tsc": "tsc", 
    "tsc:w": "tsc -w", 
    "typings": "typings", 
    "webdriver:update": "webdriver-manager update" 
    }, 
    "keywords": [], 
    "author": "", 
    "license": "ISC", 
    "dependencies": { 
    "@angular/common": "2.0.0-rc.5", 
    "@angular/compiler": "2.0.0-rc.5", 
    "@angular/core": "2.0.0-rc.5", 
    "@angular/forms": "0.3.0", 
    "@angular/http": "2.0.0-rc.5", 
    "@angular/platform-browser": "2.0.0-rc.5", 
    "@angular/platform-browser-dynamic": "2.0.0-rc.5", 
    "@angular/router": "3.0.0-rc.1", 
    "@angular/upgrade": "2.0.0-rc.5", 
    "angular2-in-memory-web-api": "0.0.15", 
    "bootstrap": "^3.3.6", 
    "core-js": "^2.4.0", 
    "ng2-bootstrap": "^1.3.3", 
    "ng2-paginate": "^0.1.0", 
    "ng2-pagination": "^2.0.0", 
    "reflect-metadata": "^0.1.3", 
    "rxjs": "5.0.0-beta.6", 
    "systemjs": "0.19.27", 
    "zone.js": "^0.6.12" 
    }, 
    "devDependencies": { 
    "concurrently": "^2.2.0", 
    "lite-server": "^2.2.0", 
    "typescript": "^1.8.10", 
    "typings": "^1.0.4", 
    "canonical-path": "0.0.2", 
    "http-server": "^0.9.0", 
    "tslint": "^3.7.4", 
    "lodash": "^4.11.1", 
    "jasmine-core": "~2.4.1", 
    "karma": "^0.13.22", 
    "karma-chrome-launcher": "^0.2.3", 
    "karma-cli": "^0.1.2", 
    "karma-htmlfile-reporter": "^0.2.2", 
    "karma-jasmine": "^0.3.8", 
    "protractor": "^3.3.0", 
    "rimraf": "^2.5.2" 
    }, 
    "repository": {} 
} 

누군가가 도움이 될 수 있습니다 것이 있습니다. 미리 감사드립니다.

답변

1

각도 버전을 업데이트해야합니다. 2.0.0-rc.6 이후 Type 클래스는 이제 일반 (Type<T>을 의미)입니다. Ng2-bootstrap은 분명히이 변경 사항을 준수하기 위해 코드를 업데이트했습니다.

ng2-bootstrap으로 몇 가지 버전으로 돌아가라고 제안 할 수도 있지만, 왜 과거에 머물러야합니다. 최신 각도로 업데이트하면됩니다. RC-5는 거의 반 년 전에 출시되었으며 출시 후보 국가에 머 무르지 않고 릴리스 버전으로 이전하면이 문제 이외의 다른 문제도 해결할 수 있습니다.

+0

그래서 package.json의'rc5'로 언급 된 패키지를'rc6'으로 업데이트하고 다른 의존성은 그대로 두어야합니까? –

+0

글쎄, 문제를 해결하는 것. 예, 작동합니다. 그러나 왜 당신은 릴리스 후보 버전에 머물고 싶습니까? – PierreDuc

+0

stable 버전 인'rc'가 아니라면 내 의존성을 마이그레이션해야합니까? –