Comments (9)
Hello there! Thanks for reporting! I made a commit which allows you to configure the button selector via the BTN_SELECTOR property of the config.
If this doesn't work: Could you by any chance provide a plunkr or something of the sort illustrating the issue?
from angular-promise-buttons.
Hello !
I applied you commit but it didn't fixed the issue.
I created the plunker : https://plnkr.co/edit/G2s27apA7h84ueviCHjI?p=preview
You just have to click "Login"
i haven't created any factory to have a proper promise as this is not needed there. If the form is valid, everything works fine.
from angular-promise-buttons.
The answer is simple: You're not giving the button any type of promise. Imho otherwise you won't need a loading spinner anyways, as the action is happening instantly. See this example: https://plnkr.co/edit/i51lgyIs9hSqhSiJ5UTG?p=preview
from angular-promise-buttons.
To quote the Readme you need to do one of the two:
// inside some controller
$scope.yourServiceCaller = function ()
{
// needs to return a promise
return fakeFactory.method().then(...);
};
// or
// inside some controller
$scope.yourServiceCaller = function ()
{
// needs to be a promise
$scope.yourPromise = fakeFactory.method().then(...);
};
from angular-promise-buttons.
When the form is valid, there are no issues with a valid promise.
I did not add any as this is not needed to reproduce.
However, if you open the plunkr, hit login with an empty password, the login method is not called (you don't see the alert, the promise is not returned to the button) but the spinner is displayed.
I tried on Chrome & Edge, same behaviour.
Edit : I have a solution, let me create a PR :)
from angular-promise-buttons.
PR : @ #34
from angular-promise-buttons.
Thank you for the pr. I'm not really sure, if I want to add form validation checks with this directive though as there might be unintended side effects (usually I handle validation with ng-fab-form). My first thought would be to pass the promise to the directive directly (e.g.: <button promisie-btn=promise>
) and only assign the promise/make the asynchronous call when the form is valid. I've to think about it though. I'll get back to you.
from angular-promise-buttons.
I debugged the issue a little further: This only occurs together when the option addClassToCurrentBtnOnly
is set to true. You usually don't need this. Only for the rare cases when you have multiple promise-btns for the same promise, but you just want to show the spinner on the currently clicked one.
from angular-promise-buttons.
Good spot ! I guess I misunderstood the addClassToCurrentBtnOnly
option.
I thought I was able to disable other buttons by specifying the same promise.
You can reject my PR, I'll set the option to false and think a bit more of how to disable the other buttons of the form while waiting for the promise.
Thanks for your help !
from angular-promise-buttons.
Related Issues (20)
- about loading text HOT 1
- Disabling all form controls while submitting the form HOT 1
- Custom form attribute name (instead of ngSubmit) HOT 2
- Set minimum seconds to see the button animation HOT 4
- [Enhancement] Add the possibility of defining CLICK_ATTR as parameter HOT 2
- Angular-material bug: The spinner does not show up HOT 9
- promise-btn and angular confirm HOT 5
- Bug: plugin breaks angular-ui bootstrap tooltips HOT 2
- angular-promise-buttons and angular 2 HOT 4
- support for Font-Awesome HOT 5
- using promise-btn with [input] element and ng-change HOT 9
- promise-btn overrides original $event HOT 3
- Spinner outside of button when using with angularjs 1.6.3 HOT 3
- Looking up elements via selectors is not supported by jqLite HOT 5
- Submit button with ng-if HOT 1
- ES6 promises not working HOT 6
- Conflict between ng-disabled and promise button HOT 1
- OpaqueToken is not a constructor - Angular 5 - breaking change HOT 4
- Use priority instead of scope.$evalAsync HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-promise-buttons.