Jump to content

Angular JS help needed


MegaPowerRockstar

Recommended Posts

this.appendForm = function (element, id) {
      element.append('' +
            '<form-valid ng-show="vm.itemsForm.itemNo' + id + '.$valid"></form-valid>'+
            '<form-invalid ng-show="vm.itemsForm.itemNo' + id + '.$touched && vm.itemsForm.itemNo' + id + '.$invalid"></form-invalid>'+
            '<div ng-messages="vm.itemsForm.itemNo' + id + '.$error" ng-show="vm.itemsForm.itemNo' + id + '.$touched">'+
            '<p class="validation-message" ng-message="required">Please enter item number</p>'
      );
};

 

try something like this in your controller.

  • Upvote 1
Link to comment
Share on other sites

1 hour ago, pandit said:

this.appendForm = function (element, id) {
      element.append('' +
            '<form-valid ng-show="vm.itemsForm.itemNo' + id + '.$valid"></form-valid>'+
            '<form-invalid ng-show="vm.itemsForm.itemNo' + id + '.$touched && vm.itemsForm.itemNo' + id + '.$invalid"></form-invalid>'+
            '<div ng-messages="vm.itemsForm.itemNo' + id + '.$error" ng-show="vm.itemsForm.itemNo' + id + '.$touched">'+
            '<p class="validation-message" ng-message="required">Please enter item number</p>'
      );
};

 

try something like this in your controller.

how to call this from html control. can you use my sample form that i posted

Link to comment
Share on other sites

1 hour ago, KATHRI said:

can you give me some idea how to apply for selectize control also..i tried below code but no luck

<div>
  <selectize config='vm.itemSelectValues' options='vm.item' ng-model="vm.newitem.otheritem[i.id].item" name="selected_item{{i.id}}" 
             id="selected_item{{i.id}}" require="true"></selectize>
  <div ng-messages="vm.otheritemForm['selected_item' + i.id].$error" ng-show="vm.otheritemForm['selected_item' + i.id].$touched">
    <p class="validation-message" ng-message="required">Please select your item.</p>
  </div>
</div>

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...