Javascript 将项目推入阵列//有角度的传单

Javascript 将项目推入阵列//有角度的传单,javascript,angularjs,Javascript,Angularjs,我是Angular的新手,因此我需要一些帮助,了解如何在markers.Vinces中推送项目 我的代码是: var app = angular.module("basicMapApp", ["leaflet-directive"]); app.controller("CenterController", [ '$scope', function($scope) { angular.extend($scope, { defaults: {

我是Angular的新手,因此我需要一些帮助,了解如何在
markers.Vinces
中推送项目

我的代码是:

var app = angular.module("basicMapApp", ["leaflet-directive"]);
app.controller("CenterController",
    [ '$scope', function($scope) {
        angular.extend($scope, {
            defaults: {
                tileLayer: "https://dnv9my2eseobd.cloudfront.net/v3/foursquare.map-ikj05elx/{z}/{x}/{y}.png",
                maxZoom: 14,
                minZoom: 3,
            },
             center: {
                lat: 52.38,
                lng: 4.8777,
                zoom: 6
            },
             markers: {
                venues: {
                    Madrid: {
                        lat: 52.38,
                        lng: 4.8777,
                        message: "This is Madrid. But you can drag me to another position",
                        focus: false,
                        draggable: true
                    },
                    Barcelona: {
                        lat: 52.38,
                        lng: 5.8777,
                        message: "This is Barcelona. You can't drag me",
                        focus: false,
                        draggable: false
                    }
                }
            }
        });

    }]
);
如何在javascript中的
markers.victions
中添加新项

e、 g.我试过了,但没有成功:

 $scope.markers.venues.push({
    Amsterdam: {
                 lat: 52.38,
                 lng: 5.9777,
                 message: "This is Amsterdam. You can't drag me",
                 focus: false,
                 draggable: false
              }
     });
有棱角的传单记录在案

试试这个

   $scope..markers.venues['Amsterdam']={
             lat: 52.38,
             lng: 5.9777,
             message: "This is Amsterdam. You can't drag me",
             focus: false,
             draggable: false
          }

$scope.markers.viouses
不是数组,因此推送不起作用。试试看:
$scope.markers.victions['Amsterdam']={/*…*/}
@yoshispot-on,谢谢你的结构通知。谢谢。在
$scope
之后有一个
:)