I have a flag I'm setting to true/false that changes the way some items are being displayed on the page. I'm running into some trouble getting the value into my template and having it actually work though. The normal HTML (not inside the template) works fine.
restrict: 'E',
scope: {
speedDirection: "@",
speedName: "@",
value: "@",
editElements: "="
},
template:
'<div>'+
'<p class="body-text">{{speedDirection}} '+
'<input type="text" name="{{speedName}}" value="{{value}}" ng-show="editElements">'+
'<span ng-hide="editElements">{{value}}</span>'+
'</p>'+
'</div>',
I would like to use the dynamic model value of editElements though, and not just the passed through value. That way when it changed it would reflect the update in the displayed template. The variable is defined in an object where I'm storing my test data:
function MyObject($scope) {
$scope.editElements = true;
Is there any way to get this to work? I've tried passing it through (as above), using the "@" and {{editElement}} bit and so on. The custom HTML portion:
<speed-limit speed-direction="A to B:"
speed-name="reverse"
value="{{newObject.speedLimit[0]}}"
editElement="editElements">
</speed-limit>
UPDATE: I've installed Batarang and it shows the specific portion of my custom element (speed-limit) to have "editElement: null". However the other areas editElements is referenced are correctly set. Is this some weird scope problem?
scope: {...}, which is editElement. Do you want the directive to use a different name or the same?