<script type="text/ng-template" id="/partials/form-input.html">
<div class="control-group" ng-class="{error: form[name].$invalid}">
<label class="control-label" for="{{name}}">{{label}}</label>
<div class="controls">
<input type="text" name="*DON'T KNOW WHAT TO PUT HERE*" class="input-xlarge" ng-model=model required></input>
<span ng-show="form[name].$error.required" class="help-inline">Required</span>
</div>
</div>
</script>
And a directive that looks like this:
myLab.directives.directive('formInput', function() {
return {
restrict: 'E',
replace: true,
scope: {
label: '@',
name: '@',
form: '=',
model: '='
},
templateUrl: '/partials/form-input.html'
}
});
then invoked like this:
<form-input form="myForm" name="myField" label="Some Field" model="model.myProperty">
Thanks,
Jon