2
HB.Core.Directives.directive('hbMultiselect', [
    function() {
        return {
            restrict: 'E',
            templateUrl: '/hb-core/library/directives/hb-multiselect/hb-multiselect-ptl.html',
            scope: {},
            controllerAs: '$ctrl',
            bindToController: {
                optionsData: '<',
                optionsSelected: '=',
                allSubtypesSelected: '='
            },
            controller: function() {
                var $ctrl = this;

                // $ctrl.$onInit = function() {
                //     console.log(this); // Tried this... didn't work either
                // };

                function init() {
                    $ctrl.isExpanded = false;
                    $ctrl.optionsDisplay = [];
                    $ctrl.tags = [];
                    console.log("------")
                    console.log($ctrl);
                    console.log("------")     
>>>>>>>>>>>>>>>>>>>>**BREAK POINT HERE**                   
                }
                init();
            }
        };
    }
]);

ブレークポイント なしでコードを実行すると、これが得られますここに画像の説明を入力

bindings optionsDataoptionsSelectedおよび allSubtypesSelected` は期待どおりに機能しています。しかし、何らかの理由でコード(上記のコードで指定) にブレークポイントを設定すると、次のようになります。

ここに画像の説明を入力

私は何も変わっていません!コードをデバッグすると $ctrl.optionsData が定義されていないため、コードが機能しませんが、その理由がわかりません。

4

1 に答える 1