Skip to content
This repository has been archived by the owner on Aug 17, 2021. It is now read-only.

Feature request - Set site-key in a service provider instead of every view #98

Closed
leosuncin opened this issue Jan 7, 2016 · 2 comments

Comments

@leosuncin
Copy link

Maybe you can add the possibility to config "site key" in one place instead on every view in order to avoid a mistype error, by example:
app.js

angular.module('appName', ['vcRecaptcha'])
.config(['vcRecaptchaProvider', function(vcRecaptcha) {
  vcRecaptcha.setSiteKey('--Site key gos here--');
}]);

controller.js

angular.module('appName')
.controller('Controller', [
  '$scope',
  'vcRecaptchaService',
  function($scope, vcRecaptchaService) {
    $scope.submitForm = function() {
      var response = vcRecaptchaService.getResponse();
    }
  }
])

view.html

<form role="form" ng-submit="submitForm()">
  <div vc-recaptcha></div>
  <button type="submit">Send</button>
</form>
@TheSharpieOne
Copy link
Contributor

I typically set it a higher up scope or even $rootScope then reference it using the controllerAs name such as app.recaptchaConfig.key or $rootScope.recaptchaConfig.key.
But yes, it would be nice and more preferable to use a provider to set the key and possibly over default values.

@mtrias
Copy link
Contributor

mtrias commented Jan 7, 2016

👍

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

No branches or pull requests

3 participants