data binding - Bind the object in combo box in Angularjs -
i have data collection in json format date, author , description. have 2 combo boxes bind date , author , text box bind description. how bind these if choose specific date combo box 1, should automatically select corresponding author in combo box 2 , corresponding description in text box. have done in jquery, not sure how in angular way. please advise.
your main scope should hold array representing collection want display on screen.
$scope.collections = [ {...}, {...}, {...} ];
then trigger function selecting appropriate data.
$scope.datechanged = function () { var appropriatedata = $scope.collections.map(function (e) { return e.date; }).indexof($scope.date); if (appropriatedate > -1) $scope.currentobject = $scope.collections[appropriatedata]; }
you can create directives in controller binding values using attributes :
<div id=box1 my-box1 author="{{ currentobject.author }}"></div>
i can't believe answer question.
Comments
Post a Comment