【发布时间】:2016-04-25 12:45:20
【问题描述】:
我想在 angular2 中使用颜色选择器。我尝试使用 npm angular2-color-picker 库。但是在包含指令后我只能看到一个空白屏幕。 (在控制台中没有发现错误)。请帮助我知道我哪里出错了,或者让我知道是否有任何其他 angular2 库可用于颜色选择。提前致谢。
我的 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"
]
}
【问题讨论】:
标签: angular color-picker angular2-directives