ng-repeat not updating the list when adding data

前端 未结 3 586
余生分开走
余生分开走 2021-01-23 02:51

my problem is that the ng-repeat is not updating automatically the data. When I press add pin in my code, the element is added correctly to the database. If I reload the page th

3条回答
  •  感情败类
    2021-01-23 03:33

    in posted code you've got typo error

    app.addPin = function (scope) {
        $http.post("/api/pin", {"title":"new", "image":"http://placekitten.com/200/200/?image=" + app.pins.length})
            .success(function(data) {
               // add.pins.push(data); <--- app not add 
                  app.pins.push(data)
            })
    }
    

提交回复
热议问题