How do I disable ngAria in ngMaterial?

后端 未结 5 1047
不知归路
不知归路 2021-01-07 17:43

ngAria (an accessibility module) is adding an unnecessary bower import to my Angular Material project - and now it is throwing warnings:

Attribute \"

5条回答
  •  清歌不尽
    2021-01-07 18:21

    If you really want to disable it, you can by simply overwriting or as angular calls it decorating the original mdAria service that's located inside the angular-material library.

    angular.module('appname').decorator('$mdAria', function mdAriaDecorator($delegate) {
        $delegate.expect = angular.noop;
        $delegate.expectAsync = angular.noop;
        $delegate.expectWithText = angular.noop;
        return $delegate;
    });
    

    This is working in angular-material v1.0.6 but you may have to check that all methods have been cleared.

    Basically all the above does is replace the public methods exposed to the $mdAria service and it will replace those methods with a noop (no operation).

提交回复
热议问题