1

Iam using a directive to form a select element, repeating the json and forming select for each element. Now change of first dropdown1 i need to change the allowed_values of dropdown2. My sample Code.

<div ng-repeat="(k,v) in data"> <dyna-select label=k field=v></dyna-select> </div> 
app.directive('dynaSelect', function() { return { restrict: 'E', template: `<div> <label>{{label}}</label> <select ng-options="items as items for items in field.allowed_values" > </select> </div>`, scope: { field:=?field, label:=?label } }; }); var data= { "dropdown1": { "allowed_values": [ "option1", "option2" ] }, "dropdown2": { "allowed_values": [] } } 
5
  • If your question isn’t about a compiler error, ensure that there are no compile-time errors. Commented Nov 30, 2018 at 13:55
  • I don't see any errors in FireBug console. Commented Dec 1, 2018 at 7:14
  • The scope property of the directive looks malformed and sketchy. Commented Dec 1, 2018 at 7:16
  • Its a typoerror, please check now. Commented Dec 1, 2018 at 9:02
  • Still looks sketchy -- Uncaught SyntaxError: Unexpected token = Commented Dec 1, 2018 at 11:30

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.