这个ng-message无法正常工作的任何原因?

时间:2015-07-12 09:40:54

标签: angularjs

我有这个代码,我不确定我的ng-massage dosent弹出...它用来工作之前我改变了一些CSS和HTML ..

之前:

<li>
    <p flex style="margin-right: 14px;" class="wm-phone" >
    <label >Phone:</label>
    <input style="  width: 92%;" 
           name="phone_number"
           ng-click="bookingPage.phone_number"
           placeholder='edit' 
           onfocus="this.placeholder = ''" 
           ng-model="bookingPage.phone_number" 
           type="number"         
           ng-minlength="6" 
           class="wm-edit wm-phone-hide-spin-button"/> 
     </p>
     <div ng-messages="BookingPageEditForm.phone_number.$error" 
     style="color:maroon;margin-left: 17px;">
        <div ng-message="number">Not a valid number</div>
    </div>
</li>

后:

<li >
<div  style="margin-right: 14px;" class="wm-phone" layout="row" layout-md="column" layout-sm="column">
    <div ><label >Phone:</label></div>
    <div > <input  
            name="phone_number"
            ng-click="bookingPage.phone_number"
            placeholder='edit' 
            onfocus="this.placeholder = ''" 
            ng-model="bookingPage.phone_number" 
            type="number"         
            ng-minlength="6" 
            class="wm-edit wm-phone-hide-spin-button"/></div> 
</div>
<div ng-messages="BookingPageEditForm.phone_number.$error" 
     style="color:maroon;margin-left: 17px;">
    <div ng-message="number">Not a valid number</div>
</div>
</li>

我试图改回来,但现在他们都没有工作......欢迎任何帮助..

1 个答案:

答案 0 :(得分:0)

问题解决了,这是我的错误,需要把它全部放在一个表单中并意外删除它。

<form method="post" 
      name="BookingForm" 
      style="margin-bottom: 67px;"
      ng-submit="settingSet()">
<li >
<div  style="margin-right: 14px;" class="wm-phone" layout="row" layout-md="column" layout-sm="column">
    <div ><label >Phone:</label></div>
    <div > <input  
            name="phone_number"
            ng-click="bookingPage.phone_number"
            placeholder='edit' 
            onfocus="this.placeholder = ''" 
            ng-model="bookingPage.phone_number" 
            type="number"         
            ng-minlength="6" 
            class="wm-edit wm-phone-hide-spin-button"/></div> 
</div>
<div ng-messages="BookingPageEditForm.phone_number.$error" 
     style="color:maroon;margin-left: 17px;">
    <div ng-message="number">Not a valid number</div>
</div>
</li>

</form>