This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tabs): refactors tabs to function closer to spec
Closes #1850 Closes #1698 Closes #1570 Closes #1564 Closes #1518 Closes #1516 Closes #1506 Closes #1505 Closes #1403 Closes #1387 Closes #1380 Closes #1261 Closes #1247 Closes #1140
- Loading branch information
1 parent
a15347c
commit a9a20bb
Showing
21 changed files
with
939 additions
and
1,354 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,40 @@ | ||
angular.module('tabsDemo2', ['ngMaterial']) | ||
.controller('AppCtrl', function ($scope, $log) { | ||
var tabs = [ | ||
{ title: 'One', content: "Tabs will become paginated if there isn't enough room for them."}, | ||
{ title: 'Two', content: "You can swipe left and right on a mobile device to change tabs."}, | ||
{ title: 'Three', content: "You can bind the selected tab via the selected attribute on the md-tabs element."}, | ||
{ title: 'Four', content: "If you set the selected tab binding to -1, it will leave no tab selected."}, | ||
{ title: 'Five', content: "If you remove a tab, it will try to select a new one."}, | ||
{ title: 'Six', content: "There's an ink bar that follows the selected tab, you can turn it off if you want."}, | ||
{ title: 'Seven', content: "If you set ng-disabled on a tab, it becomes unselectable. If the currently selected tab becomes disabled, it will try to select the next tab."}, | ||
{ title: 'Eight', content: "If you look at the source, you're using tabs to look at a demo for tabs. Recursion!"}, | ||
{ title: 'Nine', content: "If you set md-theme=\"green\" on the md-tabs element, you'll get green tabs."}, | ||
{ title: 'Ten', content: "If you're still reading this, you should just go check out the API docs for tabs!"} | ||
]; | ||
.controller('AppCtrl', function ($scope, $log) { | ||
var tabs = [ | ||
{ title: 'One', content: "Tabs will become paginated if there isn't enough room for them."}, | ||
{ title: 'Two', content: "You can swipe left and right on a mobile device to change tabs."}, | ||
{ title: 'Three', content: "You can bind the selected tab via the selected attribute on the md-tabs element."}, | ||
{ title: 'Four', content: "If you set the selected tab binding to -1, it will leave no tab selected."}, | ||
{ title: 'Five', content: "If you remove a tab, it will try to select a new one."}, | ||
{ title: 'Six', content: "There's an ink bar that follows the selected tab, you can turn it off if you want."}, | ||
{ title: 'Seven', content: "If you set ng-disabled on a tab, it becomes unselectable. If the currently selected tab becomes disabled, it will try to select the next tab."}, | ||
{ title: 'Eight', content: "If you look at the source, you're using tabs to look at a demo for tabs. Recursion!"}, | ||
{ title: 'Nine', content: "If you set md-theme=\"green\" on the md-tabs element, you'll get green tabs."}, | ||
{ title: 'Ten', content: "If you're still reading this, you should just go check out the API docs for tabs!"} | ||
], | ||
selected = null, | ||
previous = null; | ||
|
||
$scope.tabs = tabs; | ||
$scope.selectedIndex = 2; | ||
|
||
$scope.$watch('selectedIndex', function(current, old){ | ||
if ( old && (old != current)) $log.debug('Goodbye ' + tabs[old].title + '!'); | ||
if ( current ) $log.debug('Hello ' + tabs[current].title + '!'); | ||
}); | ||
$scope.tabs = tabs; | ||
$scope.selectedIndex = 2; | ||
|
||
$scope.$watch('selectedIndex', function(current, old){ | ||
previous = selected; | ||
selected = tabs[current]; | ||
if ( old && (old != current)) $log.debug('Goodbye ' + previous.title + '!'); | ||
if ( current ) $log.debug('Hello ' + selected.title + '!'); | ||
}); | ||
|
||
$scope.addTab = function (title, view) { | ||
view = view || title + " Content View"; | ||
tabs.push({ title: title, content: view, disabled: false}); | ||
}; | ||
$scope.addTab = function (title, view) { | ||
view = view || title + " Content View"; | ||
tabs.push({ title: title, content: view, disabled: false}); | ||
}; | ||
|
||
$scope.removeTab = function (tab) { | ||
for (var j = 0; j < tabs.length; j++) { | ||
if (tab.title == tabs[j].title) { | ||
$scope.tabs.splice(j, 1); | ||
break; | ||
} | ||
} | ||
}; | ||
$scope.removeTab = function (tab) { | ||
var index = tabs.indexOf(tab); | ||
tabs.splice(index, 1); | ||
}; | ||
|
||
}); | ||
}); | ||
|
36 changes: 9 additions & 27 deletions
36
...components/tabs/demoDynamicTabs/style.css → ...omponents/tabs/demoDynamicTabs/style.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.sample { | ||
height:450px; | ||
md-tab-content { | ||
padding: 25px; | ||
&:nth-child(1) { | ||
background-color: #42A5F5; | ||
} | ||
&:nth-child(2) { | ||
background-color: #689F38; | ||
} | ||
&:nth-child(3) { | ||
background-color: #26C6DA; | ||
} | ||
} | ||
.after-tabs-area { | ||
padding: 25px; | ||
> span { | ||
margin-top:25px; | ||
padding-right: 15px; | ||
vertical-align: middle; | ||
line-height: 30px; | ||
height: 35px; | ||
} | ||
> md-checkbox { | ||
margin-top:26px; | ||
margin-left:0px; | ||
} | ||
} | ||
} |
Oops, something went wrong.