0

我有角度材料 $mdDialog 的问题 - 这意味着对话框的内容正在正确显示,对话框出来并且所有行为都是正确的,例如 clickOutsideToClose:true,但我的控制台中有错误说“TypeError:无法读取属性'元素'的未定义”。这就是我的其余代码 $scopes 不起作用的原因,我必须修复这个错误,但问题出在哪里?!提前谢谢了

template.html

<md-dialog ng-cloak>
    <md-toolbar>
        <div class="md-toolbar-tools">
            <h2>You are editing {{ oldValue }} material</h2>
            <span flex></span>
            <md-button class="md-icon-button" ng-click="cancel()">
                <md-icon md-svg-src="img/icons/ic_close_24px.svg" aria-label="Close dialog"></md-icon>
            </md-button>
        </div>
    </md-toolbar>
    <md-dialog-content>
        <div class="md-dialog-content">
            <form name="addMaterial">
                <div class="row clearfix">
                    <div class="col-md-8">
                        <md-input-container class="md-block">
                            <label>Material</label>
                            <md-select name="material" ng-model="edit.material_library_id" ng-disabled="booleanVal">
                                <md-optgroup label="material">
                                    <md-option  ng-value="materialsEdits.id" ng-repeat="materialsEdits in materialsEdit track by $index">{{materialsEdits.name}}</md-option>
                                </md-optgroup>
                            </md-select>
                        </md-input-container>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-md-4">
                        <md-input-container class="md-block">
                            <label>price starting</label>
                            <input name="price_starting" ng-model="edit.price_starting" type="number" step="1">
                        </md-input-container>
                    </div>
                    <div class="col-md-4">
                        <md-input-container class="md-block">
                            <label>price per</label>
                            <input name="price_per" ng-model="edit.price_per" type="number" step="1">
                        </md-input-container>
                    </div>
                    <div class="col-md-4">
                        <md-checkbox  aria-label="Disabled checkbox" ng-model="showMorePrices">
                            Show additional prices
                        </md-checkbox>
                    </div>
                </div>
                <div class="row clearfix" ng-show="showMorePrices">
                    <div class="col-md-3">
                        <md-input-container class="md-block">
                            <label>price surface area</label>
                            <input name="price_surface_area" ng-model="edit.price_surface_area" type="number" step="1">
                        </md-input-container>
                    </div>
                    <div class="col-md-3">
                        <md-input-container class="md-block">
                            <label>price object volume</label>
                            <input name="price_object_volume" ng-model="edit.price_object_volume" type="number" step="1">
                        </md-input-container>
                    </div>
                    <div class="col-md-3">
                        <md-input-container class="md-block">
                            <label>price first print</label>
                            <input name="price_first_print" ng-model="edit.price_first_print" type="number" step="1">
                        </md-input-container>
                    </div>
                    <div class="col-md-3">
                        <md-input-container class="md-block">
                            <label>price subsequent prints</label>
                            <input name="price_subsequent_prints" ng-model="edit.price_subsequent_prints" type="number" step="1">
                        </md-input-container>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-md-8">
                        <div layout="row" layout-wrap flex ng-show="edit.material_library_id">
                            <div flex="50" ng-repeat="item in materialsEdit| filter:edit.material ">
                                <div ng-repeat="test in item.color">
                                    <div ng-repeat="(key,value) in test">
                                        <div flex-xs flex="50">
                                            <md-checkbox  ng-model="edit.color[key]" ng-click="booleanVal = !booleanVal" >
                                                {{ value}} {{ booleanVal}}
                                            </md-checkbox>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </md-dialog-content>
    <md-dialog-actions layout="row">
        <span flex></span>
        <md-button class="md-default md-raised" ng-click="hide()">
            cancel
        </md-button>
        <md-button class="md-primary md-raised" ng-click="sendEdit()">
          submit
        </md-button>
    </md-dialog-actions>
</md-dialog>

控制器:

$scope.editItem = function(ev ,id) {
   $mdDialog.show({
                templateUrl:  _BASEURL + '/js/angularApp/htmlTemplate/test.html',
                parent: angular.element(document.body),
                clickOutsideToClose:true,
                targetEvent: ev,
                controller: 'materialEditCtrl',
                fullscreen: useFullScreen
            });
         };

html

  <md-button ng-value="{{item.id}}" ng-click="editItem($event,item.id)" class="md-secondary md-raised md-accent">edit</md-button>

定义控制器无关紧要 -

4

0 回答 0