Angular List refresh/update 问题,在创建新列表项时,service(getAll) 调用没有发生
Angular List refresh/update issue, while creating new list item, service(getAll) call not happeneing
Angular 列表 refresh/update 问题,同时创建新列表项
仪表板-controller.js - 在 dashboard.html
.controller('DashboardController',
function ($scope, $state, eventService, storage) {
eventService.getEventList(storage.getCurrentUser().id).then(function (response) {
c.eventList = response;
});
事件-controller.js - 创建时-event.html
.controller('EventController',
function ($scope, $state, eventService, storage) {
this.createEvent = function () {
eventService.create(event).then(this.onResponseSuccess, this.onResponseError);
};
this.onResponseSuccess = function (payload) {
$state.go('app.dashboard');
};
问题:
我第一次可以在仪表板页面上检索事件列表,但是一旦我创建了新事件并返回到仪表板屏幕,新创建的事件不会在列表中更新,当我尝试调用 getEventList .
尝试使用 $watch
track your event by $watch here is a link which might help you
我已经使用 deleteAll() 方法清除了存储,然后调用正在运行的服务并获取最新数据列表..!
eventService.deleteAll();
eventService.getEventList(storage.getCur...
Angular 列表 refresh/update 问题,同时创建新列表项
仪表板-controller.js - 在 dashboard.html
.controller('DashboardController',
function ($scope, $state, eventService, storage) {
eventService.getEventList(storage.getCurrentUser().id).then(function (response) {
c.eventList = response;
});
事件-controller.js - 创建时-event.html
.controller('EventController',
function ($scope, $state, eventService, storage) {
this.createEvent = function () {
eventService.create(event).then(this.onResponseSuccess, this.onResponseError);
};
this.onResponseSuccess = function (payload) {
$state.go('app.dashboard');
};
问题:
我第一次可以在仪表板页面上检索事件列表,但是一旦我创建了新事件并返回到仪表板屏幕,新创建的事件不会在列表中更新,当我尝试调用 getEventList .
尝试使用 $watch
track your event by $watch here is a link which might help you
我已经使用 deleteAll() 方法清除了存储,然后调用正在运行的服务并获取最新数据列表..!
eventService.deleteAll();
eventService.getEventList(storage.getCur...