These are chat archives for luyadev/luya

17th
Oct 2017
dven84
@dven84
Oct 17 2017 09:18
Hello!
is it possible create own plugin for block var (for example, dropdown select with ajax search)?
Basil
@nadar
Oct 17 2017 09:20
hi @dven84 you mean your own angular directive?
dven84
@dven84
Oct 17 2017 09:21
yes
Basil
@nadar
Oct 17 2017 09:26

sure, you just have to make sure to use the same directive scope. Example:

zaa.directive("myDirective", function() {
    return {
        restrict: "E",
        scope : {
            'model' : '=',
            'data' : '=',
        },
        controller: function($scope, $filter) {
            $scope.$watch(function() { return $scope.model }, function(n, o) {
                console.log(n, o);
            });
        },
        template : function() {
            return '<div>{{data | json }} - {{ model }} - <input type="text" ng-model="model" /></div>';
        }
    }
});

Why does the generic select does not fit your scenario?

dven84
@dven84
Oct 17 2017 09:52

I get error after use the generic select (~1700 items for select):

code:1 file:"/var/www/ads/vendor/yiisoft/yii2/db/Command.php" line:915 message:"Allowed memory size of 268435456 bytes exhausted (tried to allocate 8192 bytes)"

Basil
@nadar
Oct 17 2017 09:52
Yes, thats a large select indeed :-)
dven84
@dven84
Oct 17 2017 10:10
and in config: ['var' => 'title', 'label' => 'Label', 'type' => 'myDirective'], ?
Basil
@nadar
Oct 17 2017 10:11
yes, but 'my-directive'
dven84
@dven84
Oct 17 2017 10:19
ok, thanks!