Skip to content

Commit

Permalink
fix(ionSideMenu): use manual transclude instead of ngTransclude
Browse files Browse the repository at this point in the history
Fixes #666
  • Loading branch information
ajoslin committed Feb 24, 2014
1 parent 17e335e commit 991d3cf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion js/ext/angular/src/directive/ionicSideMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ angular.module('ionic.ui.sideMenu', ['ionic.service.gesture', 'ionic.service.vie
replace: true,
transclude: true,
scope: true,
template: '<div class="menu menu-{{side}}" ng-transclude></div>',
template: '<div class="menu menu-{{side}}"></div>',
compile: function(element, attr, transclude) {
angular.isUndefined(attr.isEnabled) && attr.$set('isEnabled', 'true');
angular.isUndefined(attr.width) && attr.$set('width', '275');
Expand All @@ -176,6 +176,10 @@ angular.module('ionic.ui.sideMenu', ['ionic.service.gesture', 'ionic.service.vie
$scope.$watch($attr.isEnabled, function(val) {
sideMenu.setIsEnabled(!!val);
});

transclude($scope, function(clone) {
$element.append(clone);
});
};
}
};
Expand Down
7 changes: 6 additions & 1 deletion js/ext/angular/test/sideMenu.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ <h1 class="title">Slide me</h1>
<h1>Content</h1>
</ion-content>
</ion-pane>
<ion-side-menu side="left" width="$root.menuWidth || 200">
<ion-side-menu side="left" width="$root.menuWidth || 200" ng-controller="LeftCtrl">
<header class="bar bar-header bar-assertive">
<h1 class="title">Left</h1>
</header>
<ion-content has-header="true">
<h3>value = {{value}}</h3>
<ul class="list">
<a href="#" class="item" ng-repeat="item in list">
{{item.text}}
Expand Down Expand Up @@ -62,6 +63,10 @@ <h1 class="title">Right</h1>
$scope.openLeft = function() {
$ionicSideMenuDelegate.toggleLeft($scope);
};
})
.controller('LeftCtrl', function($scope) {
$scope.value = true;
$scope.list = [{text:1},{text:2},{text:3}];
});
</script>
</body>
Expand Down

0 comments on commit 991d3cf

Please sign in to comment.