Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Wait for AngularJS Service to finish running

angular.element(document.querySelector(".quantity-button.plus-button")).controller()._registeredControls[1].Scope.AddBagIfLimitNotReached = function(n) {
    let bagCount = this.option.Quantity;
    console.log("bagCount", bagCount);

        if (this.HasReachedMaximumBaggageAllowance()) {
            angular.element(document.querySelector(".quantity-button.plus-button")).controller()._registeredControls[1].LuggageDrawersService.OpenLuggageLimitReachedDrawer();
            return;
        };

        this.AddBag(n);
        this.$watch("this.option.Quantity", function (newValue) {
            console.log(`Value of foo changed ${newValue}`);
            if (newValue > 0) {
                document.querySelector(`.luggage-tile-weight-${n.Weight} .tile-title .tick-box`).classList.add("green-tick");
                displayGreenTickNoBagSelected();
            };
            if (newValue === 0) {
                document.querySelector(`.luggage-tile-weight-${n.Weight} .tile-title .tick-box`).classList.remove("green-tick");
                displayGreenTickNoBagSelected();
            };
        });
};
 
PREVIOUS NEXT
Tagged: #Wait #AngularJS #Service #finish #running
ADD COMMENT
Topic
Name
5+5 =