Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ng-infinite-autocomplete

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-infinite-autocomplete

AngularJS 1.x infinite-autocomplete wrapper

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23
decreased by-37.84%
Maintainers
1
Weekly downloads
 
Created
Source

Build Status Coverage Status

ng-inifinte-autocomplete

AngularJS 1.x Wrapper for infinite-autocomplete library

Note: Whenever I mention the CORE, then I'm targeting the infinite-autocomplete library

Install

npm i --save ng-infinite-autocomplete

Developer section

In the package.json scripts we've 4 basic tasks:

build - Build the code once

build:watch - Build the code and watch changes

test - Run tests once

test:watch - Run tests and watch changes

Usage Example

import * as angular from 'angular';
import 'ng-infinite-autocomplete';

//inject infinite-autocomplete as dependency for myApp module
angular.module('myApp', ['infinite-autocomplete'])
...

Controller:

  angular.module('myApp')
   .controller('MainCtrl', ['$http', '$q', function($http, $q){
   vm.onSelectHandler = function($element, $data) {
      console.log(arguments);
   }
   
    vm.data = [
                { text: 'Islam Attrash', value: 1},
                { text: 'Shai Reznik', value: 2},
                { text: 'Uri Shaked', value: 3},
                { text: 'Salsabel Eawissat', value: 4}
            ];
    vm.getData = function($text, $page, $fetchSize) {
        var deferred = $q.defer();
        $http.get("http://localhost:5000/data?text="+ $text + "&page=" + $page + "&fetchSize=" + $fetchSize)
          .then(function(res) {
              deferred.resolve(res.data);
          });
        return deferred.promise;
    }
   });

Template:

<div ng-controller="MainCtrl as vm">
  <!-- For Static data -->
  <ng-infinite-autocomplete
    data="vm.data"
    on-select="vm.onSelectHandler($element, $data)"
  ></ng-infinite-autocomplete>

  <!-- For external API -->
  <ng-infinite-autocomplete
    fetch-size="8"
    get-data-from-api="vm.getData($text, $page, $fetchSize)"
  ></ng-infinite-autocomplete>
</div>

Live Demo (Default Style)

Override Implementations

See this section on CORE, you pass a class via customizedInput, customizedOptions attributes

Directive Inputs/Outputs

  /**
   * data static source
   */
  data?:Array<IOption>;
  /**
   * on-select event output handler when choosing an option
   */
  onSelect?:Function($element, $data);
  /**
   * max height for the options
   */
  maxHeight?:string;
  /**
   * data dynamic api source
   */
  getDataFromApi?($text:string, $page:number, $fetchSize:number):es6Promise<Array<any>>;
  /**
   * Chunk fetch size
   */
  fetchSize?:number,
  /**
   * Customized input class to override the default input
   */
  customizedInput?:IInputCompoenentConstructor;
  /**
   * Customized options class to override the default input
   */
  customizedOptions?:IOptionsComponentConstructor;

For more See CORE

Keywords

FAQs

Package last updated on 24 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc