javascript - AngularJS dynamically changes $resource -
i making first mean app , have problem angular. in app loading resource places in controller wrote this:
$scope.place = $scope.places.$promise.then(function (collection) { collection.foreach(function (place) { if (place._id === $routeparams.id) { $scope.place = place; $rootscope.map.address = place.address; map.initmap(place.mapcoords); } }) });
it loads perfect place on page am. , on page have this:
.row .col-lg-4 .form-group label Описание textarea.form-control(rows='5', ng-model="place.description", required) .col-lg-4 .form-group label Сайт input.form-control(ng-model="place.website") .col-lg-4 .form-group label Адрес input.form-control(ng-model="place.address", ng-change="getaddress(place.addres)", required) .col-lg-4 .form-group label Снимка img(ng-src="{{ img_src || '/img/uploads/' + place._id + '.jpg' }}", height="100px", width="100px") i.fa.fa-spinner.fa-spin.fa-4x(ng-show="img_load") input.form-control(type="file", file-model="place.pic") #map .btn.btn-primary.btn-lg.pull-right(ng-click="update(place)", ng-disabled="editplaceform.$invalid") Обнови .btn.btn-danger.btn-lg.pull-right(ng-click="delete(place._id)") Премахни
the problem when change input value saves in resource without calling function this. maybe because resource cached? solutions? in advance!
Comments
Post a Comment