(function () { 'use strict'; var controllerId = 'sCtrl'; angular.module('app').controller(controllerId, ['$rootScope', '$scope','snapRemote', shell]); function shell($rootScope, $scope, snapRemote) { var vm = this;snapRemote.getSnapper().then(function (snapper) { snapper.on('open', function () { vm.isDrawerOpen = true; $scope.$broadcast('menuOpen'); }); snapper.on('close', function () { //THIS FUNCTION IS NOT CALLING IN IE10,IE11 so drawer does not get closed vm.isDrawerOpen = false; if (!$scope.$$phase) { $scope.$digest(); } }); });
I confused. Why are you not just using the same markup to open and close the drawer? I need more to go on.
In other words, why isn't your code this:
<snap-drawers> <snap-drawer> <p>Hello from drawer!</p> </snap-drawer> <div snap-drawer="right"> <p>Hello from the right drawer!</p> </div> </snap-drawers>
yes.. that the problem with already written code and the problem is to fix them!!
Desired Action: so let us say I have another button or DIV on the same page and if that when clicked should close the drawer if that is open otherwise do nothing. ( this can help me)
so e.g. in above code data-snap-toggle is directive provided by angular-snap.js similar way we can create custom directive that will do the Desired Action.
Dinesh Kumar
ASKER
e.g. there is already build a directive:
angular.module('snap')
.directive('snapClose', ['$rootScope', 'snapRemote', function($rootScope, snapRemote) {
'use strict';
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.bind('click', function() {
// Wrap in anonymous function for easier testing
snapRemote.close(scope.$eval(attrs.snapId));
$rootScope.$digest();
});
}
};
}]);
but it does not track if drawer is open only then close it, it always close it
@Rob: do you think its correct to use two directives here one is ng-click and another is snap-toggle(or snap-close) as both seems to handle click event.
Rob
They should be chainable so it shouldn't matter but if they do the same thing then remove the ng-click