-1

I already got and display the current time using angularjs. What I want to know is how can I pass this value into the dropdown? thanks

     <div class="container-fluid main_content">

    <div class="col-sm-12 col-xs-12 title_box"> 
            <h4 class="subject_title">System Time</h4> 
            <div class="" align="left" >


          <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
              <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js"></script>
    <script type="text/javascript">
     var mymodal = angular.module('mymodal', []);

mymodal.controller('Ctrl2', ['$scope', function ($scope) {
  $scope.format1 = 'M/d/yy  ';
  $scope.format = 'h:mm:ss a ';
   $scope.format2 = 'Z ';

}]);

my whole code is on this plunker file : http://plnkr.co/edit/fnqEG1jfwTWe1MNIXKDz?p=preview

i hope someone can help me

bleyk
  • 799
  • 3
  • 14
  • 41
  • does this means I still have to write time data into json or xml file? @Anil Panwar – bleyk Dec 20 '15 at 08:37
  • does this means I still have to write time data into json or xml file? @AnilPanwar ? – bleyk Dec 20 '15 at 08:50
  • why the downvote eh? – bleyk Jan 13 '16 at 01:27
  • I don't know who voted it down n why? – Anil Panwar Jan 13 '16 at 02:51
  • @AnilPanwar can you help me on how can I show the save as dialog box like this https://docs.google.com/document/d/1o9OkAOwieUMYG_kkcQbIToypO__j7RtBuHDJ96uSABs/edit?usp=sharing when I click the save button ?here's my plunker https://plnkr.co/edit/8oDrrIyn0XSduagYtadK?p=preview – bleyk Jan 13 '16 at 03:43
  • You will need sever side code to do that, follow the links http://stackoverflow.com/questions/4197955/is-it-possible-to-catch-browsers-file-open-save-dialog-event-using-javascript/13698030#13698030 and http://gruffcode.com/2010/10/28/detecting-the-file-download-dialog-in-the-browser/ – Anil Panwar Jan 13 '16 at 06:34
  • @AnilPanwar the jsfiddle file there is not available anymore.can you give a sample of this please? – bleyk Jan 13 '16 at 06:39
  • Ask new question with what ever you have tried with the server script you are using like, asp jsp or php anything you are using and your scenario,other wise it will be difficult to help buddy. – Anil Panwar Jan 13 '16 at 06:56
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/100546/discussion-between-bleykfaust-and-anil-panwar). – bleyk Jan 13 '16 at 07:02

1 Answers1

0

I am not quite sure what you mean, dropdown, I didn't see it in your demo, but I hope this is what you want, you can access the scope property all time, but inside setTimeout, you will have to use $apply, check this http://jimhoskins.com/2012/12/17/angularjs-and-apply.html :

http://plnkr.co/edit/oTGmpIPVc4r8JHrQ8cj9?p=preview

  function updateTime() {
    var dt = dateFilter(new Date(), format);
    //element.text(dt);
    scope.$apply(function() {

      scope.dropdownValue = dt;
    });
  }

In the div, access the dropdownValue:

<div class="item_contentbox"> 
        <span my-current-time="format">
          {{dropdownValue}}
      </span>
</div>
Tom
  • 4,612
  • 4
  • 32
  • 43
  • Thank You @Tom but this code assigns the current time value under the Timezone field. What I want is to make three separate dropdown fields then assign to those the value of the current time; the hour, the minutes and the seconds respectively. The value of the dropdown is also clickable and changeable for the user to edit the time he wants. Thank you – bleyk Dec 21 '15 at 00:25