Here is the directive code I am currently using:
template: '<form novalidate class="form-inline" ng-submit="submit($event, building)">' +
'<div class="form-group">' +
'<label class="form-control-static">{{label}}</label>' +
'</div>' +
'<div class="form-group">' +
'<input name="input" class="form-control" type="text" ng-model="model" />' +
'</div>' +
'<input class="btn btn-default" type="submit" value="Submit" />' +
'</form>',
scope: {
label: "@",
building: "=",
model: "=",
//type: "=",
},
Currently, in my HTML, I have to use the following code:
<building-field label="name" building="building" model="building.name"></building-field>
I would like to simplify it by only needing to add the building
and the label
(and then combine them inside the directive using ng-model="building.name"
):
<building-field label="name" building="building"></building-field>
The challenge I am facing is that I'm unsure of how to pass two directive scopes and link them as obj.prop
. How can this be achieved?