如何在maxlength超过后禁用键盘输入?

时间:2017-03-27 18:02:12

标签: angularjs ionic-framework

">

if ($('#mySelector option:selected').get().length>0) {
    //code
} else ...

<ion-content>

    <h3 class="style3"><strong>Message</strong></h3>

       <form name="form1"> 

          <div class="list">

             <label class="item item-input"  >

                <input type="text"  placeholder="Enter Number"ng-blur='SendInvit()' ng-model="message.name" name="phone" ng-required="true" />

            <span class="error-message" ng-show="form1.phone.$dirty&&form1.phone.$invalid"> </span>

       </label>

&#34; {{最大长度}}&#34; NG-变化=&#34; updateBody();&#34; NG-需要=&#34;真&#34;&GT;

<input type="text" rows="4" cols="" placeholder="Write Your Message" 

   class="area" name="phone" ng-model="message.description" ng-maxlength=

发送      取消  

以下是我的工作内容。请帮我解释一下代码 http://plnkr.co/edit/NDGeMcqzpbIqwd8sr5jM

1 个答案:

答案 0 :(得分:0)

表单对<script type="text/javascript"> @if (Auth::user()->roleplay->health_points >= 100) setHealth(1); @elseif setHealth(0.{{ Auth::user()->roleplay->health_points }}); @endif @if (Auth::user()->roleplay->energy_points >= 100) setEnergy(1, {{ Auth::user()->roleplay->energy_points }}); @elseif setEnergy(0.{{ Auth::user()->roleplay->energy_points }}, {{ Auth::user()->roleplay->energy_points }}); @endif @if (Auth::user()->roleplay->hygiene_points >= 100) setHygiene(1, {{ Auth::user()->roleplay->hygiene_points }}); @elseif setHygiene(0.{{ Auth::user()->roleplay->hygiene_points }}, {{ Auth::user()->roleplay->hygiene_points }}); @endif @if (Auth::user()->roleplay->hunger_points >= 100) setHunger(1, {{ Auth::user()->roleplay->hunger_points }}); @elseif setHunger(0.{{ Auth::user()->roleplay->hunger_points }}, {{ Auth::user()->roleplay->hunger_points }}); @endif </script> 无效时使用ng-disabled。设置控制器的最大长度。

最大长度:

ng-maxlength

伍禁用

ng-maxlength="maxlength"

这是一个有效的例子。

https://plnkr.co/edit/FC4vXw1311pnMee8d2Lz?p=preview

如果您想使用简单的解决方案 ng-disabled="form1.phone.$invalid"

祝你好运。