AngularJS, checkboxes, and generating dynamic html -
i wanting generate table dynamically using angular js, based on checked on checkboxes. problem there few fields, call them relation/column, want display always, , remaining fields if box checked. relation searched via search box (relations can have multiple columns), , want display properties of relation relevant user.
so
update time [x] update status [ ] time zone [ ] would display html along lines of
<table> <tr> <th> relation </th> <th> column </th> <th> update time </th> </tr> <tr ng-repeat= "result in results"> <td> {{result.relation}} </td> <td> {{result.column}} </td> <td> {{result.update_time}}</td> </tr> if no boxes checked, relation , column fields populated. documentation angular js taking me on place, have idea on how this?
edit : controller isn't working quite yet, still need filter search results, goes
$scope.search = function(){ //validate form input //create url input recieved $http.get(url).success(function(data){ $scope.results = angular.fromjson(data); }); } i use mojolicious backend grab data want. again, problem isn't can't data, or can't filter results based on relation. want able search based on relation, , display attributes of relation want to, based on checked. part, can't figure out.
edit again : firewall i'm @ prevents me writing comments/upvoting. shall rewarded when home tonight. thank thank you!
i think best way using ng-show expressions tied variable in model.
for example.
<input type="checkbox" ng-model="updatetime"> makes checkbox , ties result $scope.updatetime. can use variable later on via ng-show directive so...
<th ng-show="updatetime"> update time </th> ... <td ng-show="updatetime"> {{result.update_time}}</td> this means these elements show when updatetime set true (i.e checkbox checked.)
you can see example here, i've implemented 1 field should possible extend pretty easily!
Comments
Post a Comment