-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Cannot read property 'setAttribute' of null when clicking on 'menu' when using data-ng-click="$mdOpenMenu()"
#3258
Comments
I don't think this issue is completely fixed, compared to what I expected earlier in #3252. The file _menu.js contains the following references to if (!triggerElement.hasAttribute('ng-click')) {
triggerElement = triggerElement.querySelector('[ng-click]');
} this.init = function(setMenuContainer) {
menuContainer = setMenuContainer;
triggerElement = $element[0].querySelector('[ng-click]');
}; Can someone reopen this issue? |
in material/src/components/menu/js/menuController.js triggerElement = $element[0].querySelector('[ng-click],[ng-mouseenter]');
triggerElement.setAttribute('aria-expanded', 'false'); Where |
+1 |
+1 |
6 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
ng-dblclick raises this error. ng-click does not. |
Can anyone help us , we stuck at below mentioned issue..thank you in advance TypeError: Cannot read property 'setAttribute' of null at e.init |
The service is containing the following features: * Check for an element, to have the specified attribute, including the prefixes * Generate an attribute selector for the specified attribute * Build a list of all prefixed attributes Fixes angular#3258. Fixes angular#8080. Closes angular#8121
@Prajwal8 A pull request, which automatically adds the prefix is pending. |
The service is containing the following features: * Check for an element, to have the specified attribute, including the prefixes * Generate an attribute selector for the specified attribute * Build a list of all prefixed attributes Fixes angular#3258. Fixes angular#8080. Closes angular#8121
TypeError: Cannot read property 'setAttribute' of null at e.init...this issue did not solved yet, this is causing delay in completion of the project...Can anyone help us ?? |
@Prajwal8 Did you properly create a menu with an element to open the menu (~ Also the new prefixer is available in the new |
Ya...but am still facing this issue! |
@devversion am posting my code, write now i have hard coded the data...please do replay back index.html <md-menu class="persondropdown">
<md-button href="" class="md-icon-button"
ng-click="headerObj.openMenu($mdOpenMenu, $event)"
aria-label="Personal Profile Dropdown Menu">
<span><img class="personimage" src="assets/images/person.png"></span>
<span class="hidden-xs">{{loggedInUser}}</span>
<span>
<md-icon md-font-icon="zmdi zmdi-caret-down"></md-icon>
<md-tooltip>Personal Profile</md-tooltip>
</span>
</md-button>
<md-menu-content class="userflyout" width="4">
<md-subheader class="font-medium">Switch to:</md-subheader>
<md-menu-item>
<md-button ui-sref="home" aria-label="home"> <i class="profile-myprofile-icon"></i>
home </md-button>
</md-menu-item>
<md-menu-item>
<md-button ui-sref="myprofile" aria-label="myprofile"> <i class="myprofile-icon"></i> myprofile </md-button>
</md-menu-item>
<md-menu-item>
<md-button ui-sref="date" aria-label="date"> <i class="profile-date-icon"></i> date </md-button>
</md-menu-item>
<md-menu-item>
<md-button ui-sref="changePassword" aria-label="Change Password">
Change Password </md-button>
</md-menu-item>
</md-menu-content>
</md-menu>
ctrl.js
this.openMenu = function ($mdOpenMenu, ev) {
$mdOpenMenu(ev);
};
|
index.html
ctrl.js |
I cannot see any issues with that code. Tested in a codepen, and works like a charm without any errors. |
Thanks for the replay...am using the same code ,but some how am getting the error....please do suggest .what might possibly went wrong???? |
As previous mentioned, I assume you still use an older version than Also this is not the right place to discuss those things - Questions like this are normally for the Angular Material Forum |
Thank you... |
Just feed it |
TypeError: Cannot read property 'setAttribute' of null
, when click event is marked by:data-ng-click="$mdOpenMenu()"
when is marked:
ng-click="$mdOpenMenu()"
the issue disappears.
Thanks!
The text was updated successfully, but these errors were encountered: