dimanche 22 février 2015

Angular.js directive


I am trying to pass in a variable from a controller to a directives attribute value. I am using this directive http://ift.tt/1mQWipj. And my code looks like this



<div ng-controller="transactionsController">
<table class="table" data-row-style="rowStyle">
<thead>
<tr>
<th>Link to Transaction</th>
<th>Amount Invested</th>
<th>Payout Amount</th>
<th>Transaction Status</th>
<th>Time</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="transaction in transactions">
<td><a href='http://ift.tt/1DLxfeI}}'> {{transaction.input_transaction_hash}} </a></td>
<td> {{transaction.value/100000000}} </td>
<td> {{(transaction.value/100000000) * 1.2}} </td> <!--TODO: Investment % shouldn't be hardcoded -->
<td class='red' ng-if="transaction.confirmations < 6 || transaction.confirmations == null">unconfirmed</td>
<td class='green' ng-if="transaction.confirmations >= 6">confirmed</td>
<!-- <td>{{transaction.date}}</td> -->
<td><timer end-time="{{transaction.date}}">{{days}} days, {{hours}} hours, {{minutes}} minutes, {{seconds}} seconds.</timer><td>
</tr>
</tbody>
</table>
</div>
</div>


The transaction.date is from a different controller than the directive and is a String formatted date in milliseconds. You can also look here for examples of the directive. http://ift.tt/1jw86ZJ





Aucun commentaire:

Enregistrer un commentaire