Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem showing color list #1

Open
fati13592 opened this issue Mar 7, 2016 · 8 comments
Open

Problem showing color list #1

fati13592 opened this issue Mar 7, 2016 · 8 comments
Assignees
Labels

Comments

@fati13592
Copy link

Hi, i've just try your color picker and this is what is happening.
sin titulo

It only shows the little rectangle on the left. I copy paste the example.
If anyone have any idea, i would be very happy :D

@IssamEssarghini033
Copy link

I have the same problem, nothing appears :p

@JaimeStill
Copy link

I ran into the same issue. The below re-structuring of the directive caused it to work for me in Angular v 1.4.7. Note the removal of the vm from vm.property in the $templateCache.put call.

angular.module('tb-color-picker', [])
    .run(['$templateCache', function ($templateCache) {
        $templateCache.put('color-picker.tp1.html', '<div class="color-picker">' +
            '<div class="selected-color" ng-style="{\'background-color\': color}"></div>' +
            '<div class="color-palette">' +
                '<div ng-repeat="option in options"' +
                'ng-style="{\'background-color\': option}"' +
                'ng-class="{\'palette-selected-color\': option == color, \'transparent-color\': option == \'tranparent\'}"' +
                'ng-click="changeColor(option)"></div>' +
            '</div>' +
        '</div>');
    }])
    .directive('colorPicker', function () {
        return {
            restrict: 'E',
            templateUrl: 'color-picker.tp1.html',
            replace: true,
            scope: {
                color: '=',
                options: '=',
                onColorChanged: '&',
            },
            link: function (scope) {
                scope.changeColor = function (option) {
                    var old = scope.color;
                    scope.color = option;
                    scope.onColorChanged({ newColor: option, oldColor: old });
                }
            }
        };
    });

@saulo3k
Copy link

saulo3k commented Apr 6, 2017

JaimeStill your code is fine!

@JaimeStill
Copy link

@saulo3k, I'm glad it helped!

@bladepop
Copy link
Owner

bladepop commented Apr 8, 2017

@JaimeStill thanks for the input :)
Is this caused by Angular's version?
If your code works on latest version of angular I'll update the master!

@bladepop bladepop self-assigned this Apr 8, 2017
@bladepop bladepop added the bug label Apr 8, 2017
@saulo3k
Copy link

saulo3k commented Apr 8, 2017

@bladepop Congratulations for your module, my angular version is 1.4.8

@JaimeStill
Copy link

@bladepop, it's been quite a while since I messed with it, but I was using angular version 1.4.7 when I made the above adjustment. If I recall correctly, the changes were made to simplify the composition of the directive. Because the controller created in your code was specific to the directive, I just isolated the properties to the directive scope and defined the logic in the link function.

@diegosoek
Copy link

@JaimeStill your code is fine! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants