ng-model不使用文本框输入进行更新

时间:2016-06-10 14:24:13

标签: javascript angularjs

这对我来说似乎很奇怪。我有一个用于向狗步行者添加兽医的表格。数据库。我已在表单中的每个字段上使用ng-model

<div class="container-fluid" ng-show="nav.page == 'new'" ng-controller="dataController as data">
    <div class="row" ng-show="nav.tab == 'vet'">
            <div class="col-md-2">
            </div>
            <div class="col-md-8">

                <h1>Add a Vet</h1>
                <hr />
                <form>
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="Name..." ng-model="data.creator.vet.Name"/>
                    </div>
                    <div class="form-group">
                        <input type="Text" class="form-control" placeholder="Address..." ng-model="data.creator.vet.Address"/>
                    </div>
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="Phone Number..." ng-model="data.creator.vet.Phone"/>
                    </div>
                    <div class="form-group">
                        <button class="btn btn-success" ng-click="data.newVet()">Submit</button>
                    </div>
                </form>

            </div>
            <div class="col-md-2">
            </div>
        </div>
</div>

昨天它工作正常,今天我输入数据时不会更新data.creator.vet。对于我的生活,我无法看到它的任何问题。

js:

app.controller('dataController', function($http) {
dataCon = this;
this.creator = {};
this.creator.client = {};
this.creator.vet = {};
this.creator.client.Dogs = [];
this.allData = {};

this.newVet = function(){
    console.log("New Vet Creating....")
    console.log(dataCon.creator)
    vet = JSON.stringify(dataCon.creator.vet);
    console.log(vet);
    $http.get(SERVICE_URL + "?fn=vetCreate&vet=" + vet).then(function(response) {
        dataCon.init();
    });

}
});

0 个答案:

没有答案