I have an array
$result=array(
['firstname'] => 'xyz' ,
['lastname'] => 'abc');
this array value echoed in value attribute of input fields of html form
<form name="myForm" action = "<?php echo base_url('welcome/submission');?>" method="POST">
<input type="text" class="form-control" ng-model="firstname" name="firstname" value="<?php echo $result['firstname']; ?>" required ng-pattern="/^[a-zA-Z0-9]*$/">
<span ng-show="myForm.firstname.$dirty && myForm.firstname.$error.required" style="color:red;">Your name is required.</span>
<span ng-show="myForm.firstname.$dirty && myForm.firstname.$error.pattern" style="color:red;">invalid Entry.</span>
<input type="text" class="form-control" name="lastname" ng-model="lastname" value="<?php echo $result['lastname']; ?>" required>
<span ng-show="myForm.lastname.$dirty && myForm.lastname.$error.required" style="color:red;" >Last Name is required</span>
<span ng-show="myForm.lastname.$dirty && myForm.lastname.$error.pattern" style="color:red;">invalid Entry.</span>
</form>
This is angular js code
<script>
var app = angular.module('myApp',[]);
app.controller('myCtrl',function($scope){
$scope.submitForm = function() {
alert("123");
//$scope.submitted = true;
if (myForm.$valid) {
alert('Form submitted - fields passed validation');
}
};
});
</script>
I need Values should be placed properly in the value attribute of input field but it does not happen. All i can see blank input fields if i inspect element value attribute is filled with proper data but not seen in the window.
