hamid mosavi hamid mosavi - 1 month ago 8
AngularJS Question

Angularjs directive doesn't work

In the code below the ng-show hides the text but never shows back the message. The angularjs is linked and the data-binding is working but ng-show and ng-disabled with condition don't work. Please tell me if you see a problem below.

<from name="myProduct" class="main" ng-app="myProduct" novalidate>


<div class="inputbox">
<div class="boxtit">First Name</div>
<div style="width: 100%;display: block">
<input type="text" name="title" class="form-ctl" placeholder="" ng-required="true" ng-model="tit">
<span ng-show="myProduct.title.$invalid && myProduct.title.$touched" class="errormess">There's an error</span>
</div>
</div>

Answer

Maybe you need change <from> for <form>.

This a error OSI 8...

Example(fix):

<form name="myProduct" class="main" ng-app="myProduct"  novalidate>
    <div class="inputbox">
        <div class="boxtit">First Name</div>
        <div style="width: 100%;display:block">
            <input type="text" name="title" class="form-ctl" ng-required="true" ng-model="tit" />
            <span ng-show="myProduct.title.$invalid && myProduct.title.$touched" class="errormess">There's an error</span>
        </div>
    </div>
</form>
Comments