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

No progress happening #3

Open
doodirock opened this issue May 31, 2015 · 5 comments
Open

No progress happening #3

doodirock opened this issue May 31, 2015 · 5 comments

Comments

@doodirock
Copy link

Button doens't fill when I hook it into my service. Currently using:

$scope.change = function() {
  $scope.loader = NodeFactory.update({ id: $scope.newentry.nid }, $scope.data);
  $scope.loader.$promise.then(function () {
    //$state.go('start', {'id': $scope.newentry.nid});
  });
};

With my button set as:

    <button type="submit" progress-button="change()">Save &amp; Continue</button>

The server is taking about 10sec to resolve the promise, the button doesnt fill and simply flips to the done animation.

@lugovsky
Copy link
Member

lugovsky commented Jun 1, 2015

Hey Joel,

You should return promise from the callback function. In your case this would probably be:

$scope.change = function() {
  $scope.loader = NodeFactory.update({ id: $scope.newentry.nid }, $scope.data);
  return $scope.loader.$promise.then(function () {
    //$state.go('start', {'id': $scope.newentry.nid});
  });
};

Note the return statement I added

Best,
Vladimir

@doodirock
Copy link
Author

How do you normally handle using it on a form since ng-submit handles disabling the page reload and usually contains the function associated with the promise you're return. Just git rid of ng-submit?

@lugovsky
Copy link
Member

lugovsky commented Jun 2, 2015

Well, this plugin initially wasn't intended for the use with ngSubmit. Technically you can do it, but this would probably be a hack rather than proper usage. For example, you could create separate callback for progressButton, that will create promise object, that will be saved to some scope property. Later this promise can be resolved inside of ngSubmit's callback. But this all feels weird for me.

If you have no valuable reasons to have <button type="submit"> in you html and ng-submit on your form, just get rid of them and I guess you will be able to achieve what you want.

@fpernia
Copy link

fpernia commented Aug 31, 2015

I followed the instructions of md file, but I couldn't get any animation of the example page

@lugovsky
Copy link
Member

@fpernia Could you please share your code with us?

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

No branches or pull requests

3 participants