Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/424.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 需要帮助为AngularUI.util';创建数据源对象吗;用户界面滚动指令_Javascript_Angularjs_Angularjs Directive_Angular Ui - Fatal编程技术网

Javascript 需要帮助为AngularUI.util';创建数据源对象吗;用户界面滚动指令

Javascript 需要帮助为AngularUI.util';创建数据源对象吗;用户界面滚动指令,javascript,angularjs,angularjs-directive,angular-ui,Javascript,Angularjs,Angularjs Directive,Angular Ui,我有一个对象数组,我想在一个可滚动的窗口中显示,在angular中使用类似ng repeat的结构。到目前为止,我正在使用滚动条 我已经通读了,也通读了上一个关于堆栈溢出的问题。所以在我的代码中,这就是我目前所拥有的,它在运行时不会给出任何错误,也不会显示任何内容 在我的模块定义中: var app = angular.module('PromoUI', ['ngRoute', 'angularUtils.directives.dirPagination', 'ui.bootstrap','ui

我有一个对象数组,我想在一个可滚动的窗口中显示,在angular中使用类似ng repeat的结构。到目前为止,我正在使用滚动条

我已经通读了,也通读了上一个关于堆栈溢出的问题。所以在我的代码中,这就是我目前所拥有的,它在运行时不会给出任何错误,也不会显示任何内容

在我的模块定义中:

var app = angular.module('PromoUI', ['ngRoute', 'angularUtils.directives.dirPagination', 'ui.bootstrap','ui.scroll','ui.scroll.jqlite'])
    {{discounts[0].PromoCode}}
    <div ui-scroll-viewport style="height:300px">
      <div ui-scroll="discount in datasource">
        <p>{{discount.PromoCode}}</p>
        <p>{{discount.DiscountDescription}}</p>
      </div>
    </div>
在我的控制器中:

    $scope.datasource = {
        get: function (index, count, success) {
            success($scope.discounts)
        }
    }
  <!--ANGULAR UI-->
  <script src="../Scripts/angular-ui/ui-utils.js"></script>
在我看来:

var app = angular.module('PromoUI', ['ngRoute', 'angularUtils.directives.dirPagination', 'ui.bootstrap','ui.scroll','ui.scroll.jqlite'])
    {{discounts[0].PromoCode}}
    <div ui-scroll-viewport style="height:300px">
      <div ui-scroll="discount in datasource">
        <p>{{discount.PromoCode}}</p>
        <p>{{discount.DiscountDescription}}</p>
      </div>
    </div>
{{折扣[0].PromoCode}
{{discount.PromoCode}

{{折扣.折扣说明}

(请注意,{{折扣[0].PromoCode}}在浏览器中正确显示)

我的参考资料是正确的:

    $scope.datasource = {
        get: function (index, count, success) {
            success($scope.discounts)
        }
    }
  <!--ANGULAR UI-->
  <script src="../Scripts/angular-ui/ui-utils.js"></script>


我感觉我没有正确设置数据源。有谁能帮我一下吗?

我想你那里的东西也可以用,但我已经按如下方式设置好了:

app.factory('datasource',['$timeout',函数($timeout){
变量a=['a','b','c','d','e','f','g','h','i','j','k'];
var get=函数(索引、计数、成功){
回归成功(a);
};
返回{
得到:得到
};
}

]);我忘了提到您的数据源是通过页面加载进行编译的,因此如果没有定义$scope.deployments,您将看不到任何东西。