Newton's Preposterous Miscalculation

    @adopisowifi/save-config-btn

    1.0.12 • Public • Published

    AdoPisoWiFi Save Config Button

    Install

    NPM:

    $ npm i @adopisowifi/save-config-btn --save
    

    Bower:

    $ bower install --save ado-save-config-btn
    

    Usage

    Include as module dependency to your app:

    var app = angular.module('App', [
    
      'ado.save-config-btn'
    
    ])

    Set where to submit data using adoConfigServiceProvider:

    app.config(['adoConfigServiceProvider', function(adoConfigServiceProvider) {
    
      // defaults
      adoConfigServiceProvider.config({
        get_method: 'GET',
        get_url: '/settings/config',
        get_params: {},
        post_method: 'POST',
        post_url: '/settings/config',
        post_params: {}
      });
    
    }]);

    Catch broadcast events:

    app.run(['$rootScope', function ($rootScope) {
      $rootScope.$on('settings:updated', function (newConfig) {
        console.log(newConfig);
      });
      
      $rootScope.$on('settings:update:failed', function (res) {
        console.log(res);
      });
    }]);

    HTML usage:

    <save-config-btn
      config="{max_bandwidth_down: 1024}"
      btn-class="btn-primary"
      ng-disabled="myForm.$invalid"
      onSuccess="$ctrl.onSuccess"
      onError="$ctrl.onError">
        Save Changes
    </save-config-btn>

    Install

    npm i @adopisowifi/save-config-btn

    DownloadsWeekly Downloads

    27

    Version

    1.0.12

    License

    ISC

    Unpacked Size

    6.73 kB

    Total Files

    4

    Last publish

    Collaborators

    • adonesp