Coffeescript is treating finally() method of promise as a property -


the coffescript messing .finall() method of promise , making })["finally"](function() { instead of calling method of promise object.

angular.module("main.loadbalancer") .controller "createnodectrl", ($scope, $modalinstance,   loadbalancerservice, statustrackerservice, nodeservice) ->   $scope.createnode = (node) ->     $scope.disablebuttonsforrun = false     $scope.statusbar = true     $scope.nodestatus = "building"     $scope.statustype = "warning"     loadbalancerservice.getloadbalancer().then (loadbalancer) ->       nodeservice.createnode(         account_number: foo         admin_state: "enabled"         label: node.label         ip: node.ip         port: node.port         comment: node.comment         health_strategy: {}         vendor_extensions: {}       ).then((eventid) ->         $scope.disablebuttonsforrun = true         trackstatus = statustrackerservice.runeventcheck "9936", "0fd6afd9-4aa0-a5c9-ff0b3e60cdcf"         trackstatus.then (( ->           $scope.statustype = "success"           $scope.nodestatus = "completed successfully"           settimeout ( ->             $modalinstance.close()             return           ), 3000         ), ( ->           $scope.nodestatus = "failure!"           $scope.statustype = "danger"         ))         .finally ->             $scope.disablebuttonsforrun = false 

typeerror: object function () {         $scope.nodestatus = "failure!";         return $scope.statustype = "danger";       } has no method 'finally' 

angular.module("main.loadbalancer").controller("createnodectrl", function($scope, $modalinstance, loadbalancerservice, statustrackerservice, nodeservice) {   $scope.createnode = function(node) {     $scope.disablebuttonsforrun = false;     $scope.statusbar = true;     $scope.nodestatus = "building";     $scope.statustype = "warning";     return loadbalancerservice.getloadbalancer().then(function(loadbalancer) {       $scope.statusbar = true;       return nodeservice.createnode({         account_number: loadbalancer.customer,         admin_state: "enabled",         label: node.label,         ip: node.ip,         port: node.port,         comment: node.comment,         health_strategy: {},         vendor_extensions: {}       }).then(function(eventid) {         $scope.disablebuttonsforrun = true;         return statustrackerservice.runeventcheck("9936", "0fd6afd9-7-4aa0-a5c9-ff0b3e60cdcf");       }).then((function() {         $scope.statustype = "success";         return $scope.nodestatus = "completed successfully";         settimeout((function() {           $modalinstance.close();         }), 3000);       }), (function() {         $scope.nodestatus = "failure!";         return $scope.statustype = "danger";       })["finally"](function() {         return $scope.disablebuttonsforrun = false;       }));     });   }; 

you have 13 opening braces , 12 closing.

maybe ( here:

trackstatus.then (( #                ^   $scope.statustype = "success"   $scope.nodestatus = "completed successfully" 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -