Ich habe drei Module app.root, app.shell, app.shop. Und es so, dassAnsicht nicht aktualisieren mit 2 Modul angularjs
.module('app.root',['app.shell,'app.shop'])
In app.shop, ich Artikel hinzufügen, in Cookies
vm.add = function(tensp,gia,img){
var item = {
tensp : tensp,
gia : gia,
img : img
};
var cart = $cookies.getObject('cart');
if (cart) {
var items = JSON.parse(cart);
items.push(item);
$cookies.putObject('cart', JSON.stringify(items));
} else {
$cookies.putObject('cart', JSON.stringify([item]));
}
In app.shell, Ich zeige es in html
vm.cookies = JSON.parse($cookies.getObject('cart'));
{{vm.cookies.length}}
Dieses Problem ist die Ansicht nicht aktualisieren. Es wird nur aktualisiert, wenn ich die Seite aktualisiere. Wo ist mein Fehler? Bitte helfen Sie mir
Hallo wieder, bitte fügen Sie Ihre volle Ansicht und Controller. – lin
Hallo. Wenn ich ein PLNKR erstelle, hat Karim mein Problem gelöst. Aber danke für hallo mich ^^ –