stormpath / stormpath-sdk-angularjs

User Management for AngularJS (1.x) applications
http://docs.stormpath.com/angularjs/sdk/
Apache License 2.0
165 stars 58 forks source link

sp-social-login directive expects itself to be in an ng-repeat scope within sp-login-form #187

Open stevebread opened 8 years ago

stevebread commented 8 years ago

During authentication, a posting field is set which disables all form controls related to login while the login is being processed. To create a custom login page with both an sp-login-form and an sp-social-login button, 2 requirements must be met for a click of the social login button to disable itself and the sp-login-form controls:

  1. The sp-social-login button must be a part of the sp-login-form template i.e. it must be a child element of sp-login-form and not a sibling
  2. The sp-social-login button must be rendered as part of an ng-repeat because it sets the posting flag and error message on a parent scope.

The default sp-login-form template does both these things (although its missing ng-disabled=posting on the social login buttons) but its not obvious that they are required. This may be a documentation issue although it would be nice for the ng-repeat to not be a requirement. The Angular directives documentation has a section on communicating directives that might present a possible way to structure the form.