File tree Expand file tree Collapse file tree 2 files changed +7
-18
lines changed Expand file tree Collapse file tree 2 files changed +7
-18
lines changed Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ <h1>AngularJS Color Picker</h1>
147147 < div class ="row ">
148148 < h2 > No Options</ h2 >
149149 < label class ="control-label "> Color</ label >
150- < color-picker ng-model ="color2 " > </ color-picker >
150+ < color-picker class =' col-sm-1 ' ng-model ="entity.color " options =" {'format':'hex','swatchOnly':true} " / ></ color-picker >
151151 </ div >
152152
153153 < div class ="row ">
Original file line number Diff line number Diff line change @@ -365,7 +365,7 @@ export default class AngularColorPickerController {
365365 }
366366
367367 initConfig ( ) {
368- this . options = this . merge ( this . options , this . ColorPickerOptions ) ;
368+ this . mergeOptions ( this . options , this . ColorPickerOptions ) ;
369369
370370 this . visible = this . options . inline ;
371371
@@ -374,29 +374,18 @@ export default class AngularColorPickerController {
374374 }
375375 }
376376
377- merge ( options , defaultOptions ) {
378- var newObject = { } ;
377+ mergeOptions ( options , defaultOptions ) {
379378 var attr ;
380379
381380 for ( attr in defaultOptions ) {
382381 if ( defaultOptions . hasOwnProperty ( attr ) ) {
383- newObject [ attr ] = defaultOptions [ attr ] ;
384- }
385- }
386-
387- if ( typeof options === 'object' ) {
388- for ( attr in options ) {
389- if ( options . hasOwnProperty ( attr ) ) {
390- if ( typeof options [ attr ] === 'object' ) {
391- newObject [ attr ] = this . merge ( options [ attr ] , newObject [ attr ] ) ;
392- } else {
393- newObject [ attr ] = options [ attr ] ;
394- }
382+ if ( ! options || ! options . hasOwnProperty ( attr ) ) {
383+ options [ attr ] = defaultOptions [ attr ] ;
384+ } else if ( typeof defaultOptions [ attr ] === 'object' ) {
385+ this . mergeOptions ( options [ attr ] , defaultOptions [ attr ] ) ;
395386 }
396387 }
397388 }
398-
399- return newObject ;
400389 }
401390
402391 focus ( ) {
You can’t perform that action at this time.
0 commit comments