【问题标题】:can a placeholder be set on the input in an ng-table?可以在 ng-table 的输入上设置占位符吗?
【发布时间】:2015-01-26 07:14:55
【问题描述】:

有没有办法在 ngTable 中创建的 <input> 上设置占位符?

作为第二种选择,是否有另一种方法可以将输入设置为过滤器?

this 的更改将不胜感激。谢谢!

【问题讨论】:

  • 你可以有你喜欢的标题..看例子18
  • 谢谢。我希望继续使用 ng-table 生成的输入。但我可以在这里看到如何使用另一个<input> 作为过滤器模型:jitendrazaa.com/blog/webtech/web/…

标签: angularjs ngtable


【解决方案1】:

添加新的解决方案 在 ng-table html 中,做这样的事情,

<td filter="{ address: {id:'text',placeholder:'ADDRESS'}}">{{row.address}}</td>

【讨论】:

    【解决方案2】:

    为避免编辑 ng-table.js 文件,您可以添加以下内容:

    angular.module('ngTable').run(['$templateCache', function ($templateCache) {
      $templateCache.put('ng-table/filters/text.html', '<input type="text" ng-model="params.filter()[name]" ng-if="filter==\'text\'" placeholder="{{name}}" class="input-filter form-control"/>');
    }]);
    

    这将创建 ng-tables 'text' filter 'ng-table/filters/text.html' 中使用的模板的缓存副本。

    【讨论】:

      【解决方案3】:

      你可以编辑 ng-table.js

      Unminify ng-table.js (ie: http://jsbeautifier.org/) 然后在第 250 行你可以找到

      <input type="text" ng-model="params.filter()[name]" ng-if="filter==\'text\'" ,class="input-filter form-control"/>
      

      在此处添加占位符,即:

      <input type="text" ng-model="params.filter()[name]" ng-if="filter==\'text\'" placeholder="input {{name}}",class="input-filter form-control"/>
      

      请在此处查看工作演示:

      http://plnkr.co/edit/q0CMCb7evmZh1sflVV5f?p=preview

      【讨论】:

        猜你喜欢
        • 2017-10-25
        • 1970-01-01
        • 2020-04-12
        • 2014-03-31
        • 2023-03-03
        • 2014-06-14
        • 2016-12-19
        • 2011-12-13
        • 2014-12-08
        相关资源
        最近更新 更多