autocomplete, chips - Playground

In this example below you will see how to do a autocomplete, chips - Playground with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by 1kohei1, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright 1kohei1 ©

Technologies

  • HTML
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>autocomplete, chips - Playground</title>
  
  
  <link rel='stylesheet prefetch' href='https://cdn.rawgit.com/angular/bower-material/v0.10.0/angular-material.css'>

  
  
</head>

<body>

  <div ng-controller="DemoCtrl as demoController" ng-app="MyApp">
  <md-input-container md-no-float="true" layout-margin flex>
    <md-chips ng-model="demoController.first" md-require-match md-autocomplete-snap>
      <md-autocomplete md-no-chache
                       md-selected-item="demoController.first_selected"
                       md-search-text="demoController.first_search_text"
                       md-items="c in demoController.first_choice"
                       md-item-text="c"
                       md-min-length="0"
                       placeholder="Placeholder">
        <<md-item-template>
          {{ c }}
        </md-item-template>
      </md-autocomplete>
    </md-chips>
  </md-input-container>
  <div>first: {{ demoController.first }}</div>
</div>
  <script src='https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.js'></script>
<script src='https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-animate.min.js'></script>
<script src='https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-aria.min.js'></script>
<script src='https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-messages.min.js'></script>
<script src='https://cdn.rawgit.com/angular/bower-material/v0.10.1-rc4/angular-material.js'></script>
<script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/t-114/assets-cache.js'></script>
<script src='https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular-route.min.js'></script>

  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/1kohei1/autocomplete-chips-playground-PZyGpR */
(function () {
  'use strict';
  angular
      .module('MyApp')
      .controller('DemoCtrl', DemoCtrl);

  function DemoCtrl ($scope) {
    var _this = this;
    
    _this.first = [];
    _this.first_selected = null;
    _this.first_search_text = null;
    _this.first_choice = ['first_one', 'first_second', 'first_three', 'first_four'];
  }
})();

Comments