Angular Material sidenav事件播出 [英] Angular Material sidenav event broadcasted

查看:55
本文介绍了Angular Material sidenav事件播出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Angular Material的sidenav指令.当我们从组件中单击时,sidenav将关闭.当时播出的活动是什么?

I'm using sidenav directive from Angular Material. When we click out of the component, sidenav will be closed. What is the event broadcasted at that time?

推荐答案

在您的controller中,使用

In your controller use $watch to check the return value of isOpen():

  $scope.$watch(
    function () {
      return $mdSidenav('left').isOpen();
    },
    function (newValue, oldValue) {
      console.log(newValue);
      if (newValue == false) {
        var button = angular.element(document.querySelector('#navButton'))
        button.removeAttr('md-focused')
      }
    });

这篇关于Angular Material sidenav事件播出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆