代码之家  ›  专栏  ›  技术社区  ›  Renaud is Not Bill Gates

禁用angularjs中的表单元素

  •  0
  • Renaud is Not Bill Gates  · 技术社区  · 6 年前

    component('page', {
        transclude: true,
        templateUrl: 'page-component.html',
        controller: 'PageController',
        controllerAs: 'pc'
    });
    

    我就是这么用的:

    <page>
        <page-section section-id="1">
            <div>
                <ng-include src="'panelX.html'"></ng-include>
            </div>
        </page-section>
        <page-section section-id="2">
            <div>
                <ng-include src="'panelY.html'"></ng-include>
            </div>
        </page-section>
    </page>
    

    $("form").find('input, textarea, button, select, button').attr('disabled','disabled');
    

    我遇到的问题是这段代码在 panelX.html panelY.html 已加载。

    我该怎么解决?

    编辑:

    由于应用程序很大,并且它包含数百个表单,所以我不想接触html代码,我只希望页面指令中的代码适用于应用程序中的所有表单。

    0 回复  |  直到 6 年前