Angular + Firebase dateChange

时间:2016-03-27 15:11:38

标签: angularjs firebase

实际上我的代码有问题。如何在输入[' date1']上输入日期并输入[' date2']。我可能会减去这些字段,重写新变量并将结果转换为时间戳!请帮我!我会给出简短的代码。

的js

var users = new Firebase('https://watchacesadminpanel.firebaseio.com/users');

$scope.addGraph = function () {
    users.on('child_added',function (snapshot) {
        $scope.users = snapshot.val();    
        console.log($scope.users.accountCreationTime);
        if (!(datestart > dateend)){
            toastr.success("Success!");
        } else {
            toastr.error('Wrong date!');
            return false;
        }
    });
}

HTML

<div class="container">
    <div class="row">
        <div class="col-md-4">
            <div class="form-group">
                <label for="datestart" id="datestart" class='control-label'>Choose date start:</label>
                <input value="{{datestart}}" ng-model="datestart" type="date" class="font-fontawesome form-control">
                {{datestart}}
            </div>

        </div>

        <div class="col-md-4">
            <div class="form-group">
                <label for="dateend" id="dateend" class='control-label'>Choose date end:</label>
                <input ng-model="dateend" type="date" placeholder="" class="form-control">
            </div>

        </div>
    </div>

    <button ng-click="addGraph()" class="text-center btn btn-default">Show</button>
</div>

0 个答案:

没有答案