Am trying to add required to an input element in my form.
However, the form is dynamic.If I put the element manually in the page it 
works,but if i use the $compile it doesn't work.

My Html:

    <div style="padding-left:20px; padding-right:20px">
    <ng-form name="Myform">
       
                    <div id="appendHere"></div>
               
    
                    <button   type="submit" ng-disabled="Myform.$invalid" 
 class="btn btn-primary">Save</button>
                  
                </div>
    
        </div>
    </ng-form></div>

My Controlles js:

    'use strict';
    
    myapp.controller("CompileController", ["$scope", "$compile", 
        function ($scope, $compile) {
     var $result = $("<ng-form name='form'><div 
class='form-group'><h5><label class='col-xs-2 col-form-label'>Absence 
Status</label></h5><div class='col-xs-10'><input class='form-control' 
required  name='AbsenceStatus' type='text' 
ng-model='requestL.AbsenceStatus'/></div></div></ng-form>").appendTo(angular.element("#appendHere"));
        
    
            $compile($result)($scope);
    
      }]);

Any help would be highly appreciated. I am using angularjs 1.5.8.

Thx,

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to