小编Arj*_*ier的帖子

为什么我们需要 OOP 中的构造函数?

我是 OOP 的新手。我还处于学习阶段。

为什么需要构造函数,何时可以通过编写“初始化函数”来初始化属性(变量)的值?

基本上,当我们甚至通过编写用于初始化变量的函数也可以获得相同的结果时,为什么还要编写构造函数呢?

oop methods constructor

3
推荐指数
2
解决办法
2万
查看次数

AngularJS-jQuery-ui-sortable g.sortable不是函数

我正在使用ui-sortable创建具有可拖动行的表

<tbody ui-sortable="sortableOptions" ng-model="model.list">
   <tr ng-repeat="item in model.list">
      <td>
          <div class="form-group">
              <input type="text" class="form-control test-input" ng-model="item.Country" ng-readonly="!isEditable">
          </div>
      </td>
      <td>
          <div class="form-group">
              <input type="text" class="form-control test-input" ng-model="item.Value" ng-readonly="!isEditable">
          </div>
      </td>
   </tr>
Run Code Online (Sandbox Code Playgroud)

这是控制器中的代码。

$scope.sortableOptions = {
            update: function(e, ui) {

                console.log(model.list);
            },
            stop: function(e, ui) {

                console.log(model.list);
            }
        };
Run Code Online (Sandbox Code Playgroud)

我已经使用了require.js并将依赖项ui.sortable添加到那里。

每当我打开带有此表的页面时,都会出现此错误-

angular.js:12520 TypeError: g.sortable is not a function at w (http://localhost:90/bower_components/angular-ui-sortable/sortable.min.js:8:4649) at x (http://localhost:90/bower_components/angular-ui-sortable/sortable.min.js:8:4721) at link (http://localhost:90/bower_components/angular-ui-sortable/sortable.min.js:8:5003) at http://localhost:90/bower_components/angular/angular.js:8835:44 at invokeLinkFn (http://localhost:90/bower_components/angular/angular.js:8841:9) at nodeLinkFn (http://localhost:90/bower_components/angular/angular.js:8335:11) at compositeLinkFn (http://localhost:90/bower_components/angular/angular.js:7731:13) at …

jquery jquery-ui-sortable requirejs angularjs

3
推荐指数
1
解决办法
3161
查看次数