File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 17
17
restrict : 'E' ,
18
18
transclude : true ,
19
19
scope : {
20
- current : '=?'
20
+ current : '=?' ,
21
+ autoSelect : '=?'
21
22
} ,
22
23
controller : [ '$scope' , '$element' , function ( $scope , $element ) {
23
24
var panes = $scope . panes = [ ] ,
24
25
selected ;
25
26
27
+ $scope . autoSelect = $scope . autoSelect === undefined ? true : $scope . autoSelect ;
28
+
26
29
$scope . select = function ( pane ) {
27
30
selected = pane ;
28
31
angular . forEach ( panes , function ( pane ) {
33
36
}
34
37
35
38
this . addPane = function ( pane ) {
36
- if ( panes . length == 0 )
39
+ if ( panes . length == 0 && $scope . autoSelect ||
40
+ ( pane . name || pane . title ) === $scope . current )
37
41
$scope . select ( pane ) ;
38
42
39
43
panes . push ( pane ) ;
40
44
}
41
45
42
46
// Allow for programmatic tab selection
43
47
$scope . $watch ( 'current' , function ( val ) {
44
- if ( val !== ( selected . name || selected . title ) ) {
48
+ if ( val && ( selected === undefined || val !== ( selected . name || selected . title ) ) ) {
45
49
angular . forEach ( panes , function ( pane ) {
46
50
if ( val === ( selected . name || selected . title ) ) {
47
51
pane . selected = true ;
You can’t perform that action at this time.
0 commit comments