head部分:
html部分:
通过设置改变开关:
弹出!
html5jq-FE学习平台欢迎您!
js代码 :
angular.module('myApp',['ui.bootstrap']).controller('tabDemo',function($scope,$window){ //我不想说了。。只要看过这一列系demo的都应该明白了
$scope.tabs = [
{title : 'jquery' ,content : '我是jquery内容'},
{title : 'angular' ,content : '我是angular内容'}
];
$scope.alertMe = function(){
$window.alert('html5jq-FE学习平台欢迎您!')
}
})
用angular渲染bootstrap中的tab切换的
思路:先加载scope中的tabs,然后利用后台bootstrap渲染即可。
1、angularjs代码:
angular.module('TabsApp', [])
.controller('TabsCtrl', ['$scope', function ($scope) {
$scope.tabs = [{
title: 'One',
url: 'one.tpl.html'
}, {
title: 'Two',
url: 'two.tpl.html'
}, {
title: 'Three',
url: 'three.tpl.html'
}];
$scope.currentTab = 'one.tpl.html';
$scope.onClickTab = function (tab) {
$scope.currentTab = tab.url;
}
$scope.isActiveTab = function(tabUrl) {
return tabUrl == $scope.currentTab;
}
}]);
2、渲染效果: