From acc8e97e602ef49d3c05b7d2421c2ca68fec5ae6 Mon Sep 17 00:00:00 2001 From: Alberto Pujante Date: Sun, 1 May 2016 17:47:20 +0200 Subject: [PATCH] 1.0.3 Updated for Angular2 beta 17 Breaking change: DynamicComponentLoader.loadNextToLocation now takes a ViewContainerRef instead of an ElementRef --- app/color-picker/color-picker.directive.ts | 13 ++++++++----- bower.json | 2 +- index.html | 8 ++++---- package.json | 10 +++++----- tsconfig.json | 2 -- typings.json | 4 ++-- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/app/color-picker/color-picker.directive.ts b/app/color-picker/color-picker.directive.ts index d8e8df5..a182f11 100644 --- a/app/color-picker/color-picker.directive.ts +++ b/app/color-picker/color-picker.directive.ts @@ -1,7 +1,10 @@ -import {Component, DynamicComponentLoader, Directive, Input, Output, ElementRef, EventEmitter, OnInit} from 'angular2/core'; +import {Component, DynamicComponentLoader, Directive, Input, Output, ViewContainerRef, ElementRef, EventEmitter, OnInit} from 'angular2/core'; import {ColorPickerService} from './color-picker.service'; import {Rgba, Hsla, Hsva, SliderPosition, SliderDimension} from './classes'; +const styleUrls: string[] = ['app/color-picker/color-picker.css']; +const templateUrl: string = 'app/color-picker/color-picker.html'; + @Directive({ selector: '[colorPicker]', host: { @@ -23,7 +26,7 @@ export class ColorPickerDirective implements OnInit { private dialog: any; private created: boolean; - constructor(private dcl: DynamicComponentLoader, private el: ElementRef, private service: ColorPickerService) { + constructor(private dcl: DynamicComponentLoader, private vcRef: ViewContainerRef, private el: ElementRef, private service: ColorPickerService) { this.created = false; } @@ -37,7 +40,7 @@ export class ColorPickerDirective implements OnInit { onClick() { if (!this.created) { this.created = true; - this.dcl.loadNextToLocation(DialogComponent, this.el) + this.dcl.loadNextToLocation(DialogComponent, this.vcRef) .then((res) => { res.instance.setDialog(this, this.el, this.colorPicker, this.cpPosition, this.cpPositionOffset, this.cpPositionRelativeToArrow, this.cpOutputFormat, this.cpCancelButton, this.cpCancelButtonClass, this.cpCancelButtonText, this.cpHeight); @@ -148,8 +151,8 @@ export class SliderDirective { @Component({ selector: 'color-picker', - templateUrl: 'app/color-picker/color-picker.html', - styleUrls: ['app/color-picker/color-picker.css'], + templateUrl: templateUrl, + styleUrls: styleUrls, directives: [SliderDirective, TextDirective] }) export class DialogComponent implements OnInit { diff --git a/bower.json b/bower.json index ceef400..70c5a7f 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "angular2-color-picker", - "version": "1.0.2", + "version": "1.0.3", "authors": [ "Alberto Pujante " ], diff --git a/index.html b/index.html index 35350ab..e8d4399 100644 --- a/index.html +++ b/index.html @@ -8,13 +8,13 @@ - + - + - - + +