SHARE
TWEET

Untitled

a guest Jun 24th, 2019 137 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var tech=[
  2.     {name:"android", rate:0,bar:10},
  3.     {name:"angular", rate:0,bar:10},
  4.     {name:"node", rate:0,bar:10},
  5.     {name:"maven", rate:0,bar:10},
  6.     {name:"log", rate:0,bar:10},
  7.     {name:"vs2019", rate:0,bar:10}
  8.   ];
  9.   $scope.tech=tech;
  10.   $scope.incrementRate= function(t,r)
  11.   {
  12.      t.rate=r;
  13.      t.bar=parseInt(t.bar)+Number(r); //giving NaN
  14.      alert(t.bar); //giving undefined
  15.   };
  16.      
  17. <table>
  18. <tr>
  19.          <td>Select course:</td>
  20.          <td><select class="form-control contact-text" name="course" ng-model="tech.name">
  21.            <option ng-repeat="t in tech"
  22.         ng-value="t.name">{{t.name}}</option>
  23.          </select> <br> </td>
  24.  
  25.        </tr>
  26.        <tr>
  27.          <td>Rate:</td>
  28.          <td><input type="radio" class="ml-3" name="rate" value="1" checked ng-model="tech.rate"> 1
  29.              <input type="radio" class="ml-3" name="rate" value="2" ng-model="tech.rate"> 2
  30.             <input type="radio" class="ml-3" name="rate" value="3" ng-model="tech.rate"> 3
  31.             <input type="radio" class="ml-3" name="rate" value="4" ng-model="tech.rate"> 4
  32.             <input type="radio" class="ml-3" name="rate" value="5" ng-model="tech.rate"> 5
  33.             </td>
  34.        </tr>
  35.        <tr>
  36.          <td colspan="2" style="text-align:center"><br> <br>
  37.            <button type="submit" name="rate" class="btn btn-primary"
  38.            ng-click="incrementRate(tech,tech.rate)">Rate</button></td>
  39.  
  40.        </tr>
  41.      </table>
  42. <!-- for eg, -->
  43. Android:
  44.     <div class="wrapper">
  45.       <div class="android skills" ng-style="{'width':tech[0].bar+'%'}">
  46.   {{tech[0].bar+'%'}}
  47.       </div>
  48.       </div>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top