Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have following code:

<div ng-repeat="dateDetails in visitsDates | orderBy : dateDetails.date | filter : contactid | limitTo : 1">
    <tr>
        <td>Joint Work</td>
        <td>{{dateDetails.joint_work}}</td>
    </tr>
    <tr>
        <td>Gap</td>
        <td><a href="" ng-click="gap(dateDetails.date)">Click Me</a></td>
    </tr>
</div>

in above code, I have put ng-click, after which the function is called. But the function has to be called by default so as to populate one of the columns, which is not happening. the function 'gap' sets $scope.gap to the difference between today's date and the date passed to it. How should I fix the problem?

share|improve this question
    
I suggest to pre-manipulate visitsDates, use Array#map –  Ilan Frumer Jun 12 '14 at 6:39

1 Answer 1

up vote 1 down vote accepted

If you have to do it with markup you can use ng-init

Also, from the same link, can't you set up initial value using your controller?

share|improve this answer
    
Thanks @Darshan, it worked using ng-init.. thank you so much :) –  Ru11 Jun 12 '14 at 7:08
    
Happy to help :) –  Darshan Joshi Jun 12 '14 at 8:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.