<!doctype html> <html> <head> <style type="text/css"> div { padding: 5px; } </style> </head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> <script language="javascript"> var TimestampModel = function() { this.isMillisecond = null; this.timestamp = null; } var myApp = angular.module( "myApp", [] ); myApp.controller( "init", [ "$scope", function( $scope ) { $scope.timeStampModelList = [ ]; $scope.eventBtnAddNgClick = function() { var firstOne = new TimestampModel(); firstOne.isMillisecond = true; firstOne.timestamp = new Date().getTime(); $scope.timeStampModelList.push( firstOne ); } $scope.eventBtnRemoveNgClick = function() { $scope.timeStampModelList.pop(); } $scope.eventBtnAddNgClick(); } ] ); </script> <!--<script type="text/ng-template" id="template">--> <!--<div ng-controller="timeController">--> <!--<label>Millisecond<input type="checkbox" ng-model="isMillisecond1" ng-change="eventTime1NgChange()" /></label> --> <!--<input type="number" ng-model="time1" /> --> <!--{{ ( time1 * millisecond1 ) | date : "yyyy-MM-dd HH:mm:ss:sss" :timezone }}--> <!--</div>--> <!--</script>--> <body ng-app="myApp" ng-controller="init"> <div > <button ng-click="eventBtnAddNgClick();">Add</button> <button ng-click="eventBtnRemoveNgClick()">Remove</button> </div> <div id="container"> </div> <div ng-repeat="timestampModel in timeStampModelList" > <label>Millisecond<input type="checkbox" ng-model="timestampModel.isMillisecond" /></label> <input type="number" ng-model="timestampModel.timestamp" /> {{ ( timestampModel.timestamp * ( timestampModel.isMillisecond ? 1 : 1000 ) ) | date : "yyyy-MM-dd HH:mm:ss:sss" :timezone }} </div> </body> </html>