1
我想在角度2中使用顏色選擇器。我嘗試使用npm angular2-color-picker庫。但是在包含該指令後,我只能看到一個空白屏幕。 (在控制檯中找不到錯誤)。請幫助我知道我錯了什麼或讓我知道是否有任何其他angular2庫可用於顏色選擇。提前感謝。角度2中的顏色選擇器
我的HTML包括:
<div>
<label>Primary</label>
<input [(colorPicker)]="color" [style.background]="color" [value]="color"/>
</div>
我的TS:(AppComponent頁航線DesignPage)
import {Component, OnInit} from 'angular2/core';
import {ColorPickerDirective} from 'angular2-color-picker/app/color-picker/color-picker.directive';
@Component({
selector: 'my-design',
templateUrl: 'wwwWeb/build/component/design/design.html',
directives: [ColorPickerDirective]
})
export class DesignPage implements OnInit {
private color: string = "#127bdc";
}
我Boot.ts
import {bootstrap} from 'angular2/platform/browser';
import {AppComponent} from './app.component';
import {ColorPickerService} from './color-picker/color-picker.service'
bootstrap(AppComponent, [ColorPickerService]);
我Tsconfig
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"../node_modules",
"typings/main",
"typings/main.d.ts"
]
}
我使用CommonJS的作爲該庫被編譯爲模塊SystemJS模塊 – AishApp
。如果你想和comonjs一起使用它,你需要重新編譯它。你可以在你的問題中添加你使用的TypeScript編譯器的配置嗎?謝謝! –
抱歉,延遲響應。我編輯了我的問題 – AishApp