angularjs - Display value form nested ng-repeat option in Angular -


i need display option chosen select in table columns , row generated dynamically , in second table want background color cell in color choose in first table, don't know articleitem.not_mixed_colors.rgb , use in second table?

my code:

  <table class="table-bordered table-condensed table-select" ng-class="[{'add-colors-table': pynumber >= 24 }]">     <thead>         <tr>             <th ng-repeat="m in [] | rangefilter:0:pynumber" ng-class="[{'border': $index+1 == divone }, {'border': $index+1 == divtwo }, {'border': $index+1 == divthree }]" >{{$index+1}}</th>         </tr>     </thead>     <tbody>         <tr ng-repeat="articleitem in articlecolors">             <td ng-repeat="m in [] | rangefilter:0:pynumber" ng-class="[{'border': $index+1 == divone }, {'border': $index+1 == divtwo }, {'border': $index+1 == divthree }]"  class="select-td">                   <select id="articlecolorsdata" name="py{{$index+1}}" class="form-control" ng-model="articlecolorsdata.kolory[$index]" ng-init="articlecolorsdata.kolory[$index] = 'x'">                     <option ng-value="x"  value="x">x</option>                     <option tooltip-placement="top" uib-tooltip="{{ onecolor }}" ng-repeat="onecolor in articleitem.all_colors" ng-value="x"  value="{{ onecolor }}" ng-model="onecolor">{{ onecolor }}</option>                 </select>               </td>                                                   </tr>     </tbody> </table>  <table>     <tbody>         <tr ng-repeat="articleitem in articlecolors">             <td width="58" ng-repeat="m in [] | rangefilter:0:pynumber" ng-class="[{'border': $index+1 == divone }, {'border': $index+1 == divtwo }, {'border': $index+1 == divthree }]"  class="select-td">                   <div id="articlecolorsdata" name="py{{$index+1}}" class="form-control" tooltip-placement="bottom" uib-tooltip="{{articlecolorsdata.kolory[$index]}}">                     {{articlecolorsdata.kolory[$index]}}                 </div>               </td>                                                   </tr>     </tbody> </table> 

extra info:

-selected color saved database $scope.articlecolorsdata,

-rangefilter() - filter generate columns,

-articlecolors data below:

[{             "id_art": "2084",             "id_rys": "311",             "nazwa_art": "nowy",             "kolory_pod": "y,m",             "pantony": "p1777,p179,p188,p1905,p1795",             "kolory_art": "y,m,m50+y100,p1777,p179,p188,p1905,p1795",             "all_colors": ["y", "m", "m50+y100", "p1777", "p179", "p188", "p1905", "p1795"],             "not_mixed_colors": [{                 "color_name": "y",                 "rgb": "255,255,0"             }, {                 "color_name": "m",                 "rgb": "255,0,255"             }, {                 "color_name": "p1777",                 "rgb": "255,107,163"             }, {                 "color_name": "p179",                 "rgb": "255,31,23"             }, {                 "color_name": "p188",                 "rgb": "103,6,48"             }, {                 "color_name": "p1905",                 "rgb": "255,138,240"             }, {                 "color_name": "p1795",                 "rgb": "255,8,31"             }]         }] 

[edit] controller code:

apppokayoke.controller('createarticlecolorsctr', ['$scope', '$http','$routeparams', 'articles', '$location', 'articlesofdrawings', function ($scope, $http, $routeparams, articles, $location, articlesofdrawings, rangefilter ) {           var drawingid = $routeparams.drawingid;         var pynumber = $routeparams.pynumber;         var articlename = $routeparams.articlename;         var divone = $routeparams.divone;         var divtwo = $routeparams.divtwo;         var divthree = $routeparams.divthree;          $scope.filterby = {};          $scope.pynumber = $routeparams.pynumber;          var divone = $routeparams.divone;         $scope.divone = divone;           var divtwo = $routeparams.divtwo;         $scope.divtwo = divtwo;           var divthree = $routeparams.divthree;         $scope.divthree = divthree;           $scope.articlecolors = {};         $scope.articlecolorsdata = {         "id_rys" : drawingid,          "ile_py" : pynumber,          "nazwa_art" : articlename,          };          articles.getnewarticle(             $routeparams.articlename,              $routeparams.drawingid,             function (data) {                 if(data !== '') {                     $scope.articlecolors = data;                     console.log('articlecolors:');                     console.log($scope.articlecolors);                  }                 else {                     console.log('not ok articlecolors');                   }             }         );          // tabelka z dodanymi już artykułami         articlesofdrawings.getarticlesofdrawings(             $routeparams.pynumber,              $routeparams.drawingid,             function (data) {                 console.log("getarticlesofdrawings data:" + data + "/");                 if(data !== '') {                     $scope.articlesofdrawings = data;                     console.log('articlesofdrawings:');                       console.log($scope.articlesofdrawings);                  }                 else {                      console.log('not ok articlesofdrawings');                   }             }         );           $scope.savearticlecolors = function (articlecolorsdata, success) {              success = success || function() {};              $http.post('api/admin/articles/save_colors/', {articlecolorsdata:articlecolorsdata})             .success(function (errors, data){                  if ( errors) {                     $scope.errors = errors;                      console.log($scope.errors);                 }                 else {                     success(data.articlecolorsdata);                     $scope.articlecolorsdata = articlecolorsdata;                     console.log("save article: "+ $scope.articlecolorsdata);                     $location.path('/admin/drawings/'+ drawingid + '/' + pynumber +'/' + divone +'/' + divtwo +'/' + divthree);                 }              }).error(function (){                 console.log('problem articlecolors');             });          }      }]); 


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -