PhoneJS& AngularJS问题

时间:2014-01-29 21:28:25

标签: angularjs phonejs

我遇到了PhoneJS和AngularJS的问题。我似乎无法将一个非常简单的选择框小部件绑定到$ scope变量。当我更改$ scope变量根本没有更新的选择框时。

HTML:

<div ng-controller="ServiceProviderCtrl">
<div dx-toolbar="{ items: [{ align: 'center', text: 'SERVICE PROVIDER' }] }"></div>
<div class="dx-fieldset">
    <div class="dx-field">
        <div class="dx-field-label">Choose Your Service Provider</div>
        <div class="dx-field-value" dx-select-box="{ bindingOptions: { value: 'data.serviceProvider' },dataSource: serviceProviders, displayExpr: 'company', valueExpr: '_id' }"></div> 

    </div>
</div>
{{data.serviceProvider}}
</div>

控制器:

app.register.controller('ServiceProviderCtrl', function($scope, $http, $state, configs, CurrentState) {
    $scope.data = {
        serviceProvider: 'bbb'
    };


    $scope.serviceProviders = new DevExpress.data.DataSource({
        load: function() {
            return $.ajax({
                url: 'http://' + configs.domainName + '/account/service-providers',
                xhrFields: {
                    withCredentials: true
                }
            });
        },
        map: function(data) {
            data.text = data.company;
            return data;
        },
        byKey: function(key, extra) {
            return _.first(_.where($scope.serviceProviders.items(), {
                _id: key
            }));
        },
    });
});

如果您有任何建议,请与我们联系。至于“register”语法,我正在使用angularAMD。

0 个答案:

没有答案