zoukankan      html  css  js  c++  java
  • 关于angularjs+typeahead的整合

    和angularjs-xeditable的基本相似,主要区别在于前者用于普通input中,后者用于xeditable中

    在angularjs-xeditable需要自动提示的地方要用e-uib-typeahead和e-typeahead-on-select,而在普通页面时需要使用uib-typeahead和typeahead-on-select。

    当然首先需要加入模块

    var Myapp = angular.module('Myapp ',['xeditable']);

    HTML代码如下

    angularjs-xeditable中

            <span editable-text="product.type" e-name="type" e-form="rowform" 
             e-uib-typeahead="products.type  for products in products | filter:$viewValue | limitTo:8" 
             e-typeahead-on-select="getProductDetail($item, $model)" 
              >
               {{ product.type || 'empty' }}
            </span>

    普通的input中

    <input type="text" id="choseDeviceName" name="choseDeviceName" class="form-control" ng-model="selected" 
    uib-typeahead="products.type  for products in products | filter:$viewValue | limitTo:8" 
    typeahead-on-select="funcGetProductDetail($item, $model, $label, $event)"  
    > 

     JS的数据

    $http.get('selectProducts').successs(function(data){
      $scope.products=data;
    })
  • 相关阅读:
    10查询结果排序
    11汇总和分组数据
    09查询基础
    07修改数据
    08删除数据
    06插入数据
    PHP 判断数组是否为空的5大方法
    Mysql模糊查询like效率,以及更高效的写法
    经典面试题golang实现方式(一)
    php调用c语言编写的so动态库
  • 原文地址:https://www.cnblogs.com/wangzun/p/6277321.html
Copyright © 2011-2022 走看看