Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property '$parent' of undefined #44

Open
Komald opened this issue Jul 16, 2018 · 1 comment
Open

TypeError: Cannot read property '$parent' of undefined #44

Komald opened this issue Jul 16, 2018 · 1 comment

Comments

@Komald
Copy link

Komald commented Jul 16, 2018

angular-material-sidemenu version: 1.0.5
I am using gulp to build and serve my web app.
When I am using gulp-serve the project is starting from my root/src/main/ folder and angular-material-sidemenu is working properly.

but when I do gulp-build, a build is getting generated and saved in root/build/www and angular-material-sidemenu is getting compressed and saved in vendor.js file.

                 <md-sidemenu-group>
                      <md-sidemenu-button ui-sref="journal">
                          <md-icon md-svg-src="content/images/PL_Services.svg">book</md-icon>
                          <span data-translate="sidebar.menu.journal">journal</span>
                      </md-sidemenu-button>
                  </md-sidemenu-group>

This is working correctly and journal state is loaded, but

                  <md-sidemenu-group>
                    <md-sidemenu-content collapse-other="true" md-svg-icon="content/images/PL_Contacts.svg" md-heading="{{'sidebar.menu.contacts.title'|translate}}" md-arrow="true">
                      <md-sidemenu-button ui-sref="contacts">
                        <md-icon class="ng-binding ng-scope material-icons" role="img">person</md-icon>
                        <span data-translate="sidebar.menu.contacts.view">View</span>
                      </md-sidemenu-button>

                      <md-sidemenu-button ui-sref="trustContact">
                        <md-icon class="ng-binding ng-scope material-icons" role="img">person_add</md-icon>
                        <span data-translate="sidebar.menu.contacts.new">Add</span>
                      </md-sidemenu-button>
                    </md-sidemenu-content>
                  </md-sidemenu-group>

is not expanding and showing the two buttons inside the md-sidemenu-content.

It's throwing error TypeError: Cannot read property '$parent' of undefined.

material-sidemenu-err

@Komald
Copy link
Author

Komald commented Jul 17, 2018

It seems that while collapse-other="true" its breaking at

angular.element(allmenu[i]).scope().$parent.$mdSidemenuContent.visible = false;

It's somehow not able to handle scope() of angular.element(allmenu[i]) and that is throwing the undefined error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant