AngularJS – Tab 介紹篇
為了方便文章閱讀,本篇將Tab翻譯成頁籤
這個案例的複雜度會比較前面高一些,因為它不僅僅是使用我們一直提到的AngularJS,為了要製作頁面上面的一些互動效果,還加入了Bootstrape這個通常被用來當RWD的框架,不過也僅僅是套用了幾個類別,所以大家也不用太擔心,接下來我們先看一下這個案例最後希望要達成的效果頁面。
在看過了目標頁面後,我們先來了解一下需要怎麼樣架構我們的HTML,首先是CSS和Javascript的引入,分別是AngularJS、jQuery、Bootstrap CSS以及Javascript:
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script> <script src="https://code.jquery.com/jquery.min.js"></script> <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
在HTML文件中,必須有項目清單標籤ul、li,而在ul標籤中需套用nav nav-pills這兩個css類別,這兩個類別是由Bootstrape的css所提供的,li標籤是包覆著超連結的a標籤,下圖案例是希望可以產生三個頁籤。

在a標籤中加入ng-click=”tab = 1″、ng-click=”tab = 2″、ng-click=”tab = 3″去設定當使用者按下連結後tab變數會隨著變化,另外為了方便觀察是否成功,在頁面上利用表達式將tab變數顯示出來。

若一切順利,在我們按下不同的頁籤連結時,畫面上應該會有數字上面的變化。


接下來開始製作點選頁籤後的內容頁面,同樣的內容頁面也應該有三個才對,在HTML中產生三個div,其中套用Bootstrape所提供的CSS panel類別,div的內容部分可依照需求置入。

在div中利用ng-show去判斷tab變數的值來切換顯示。

完成後,在我們點選不同的連結時,內容的部分也應該會隨著變動。

接下來我們在section標籤中設定ng-init=”tab=1″的屬性來決定tab變數的初始值。

接下來在li內新增ng-class的屬性,依tab變數的值來切換active的CSS屬性(該屬性由Bootstrape提供樣式),其中三個連續的等號是判斷該變數與值完全相同的意思。

這個動作的目的是希望當網友點選之後,可以如下圖所示,清楚的標示目前頁面上所顯示的是第幾個項目。

到目前為止,大概就完成了我們希望呈現的頁籤效果,大家可以透過JS Bin來測試看看到目前為止的程式碼。
<!DOCTYPE html> <html ng-app> <head> <meta name="description" content="AngularJS Tabs Example 1"> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script> <script src="//code.jquery.com/jquery.min.js"></script> <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script> <meta charset="utf-8"> <title>AngularJS Tabs Example 1</title> </head> <body> <section ng-init="tab=1"> <ul class="nav nav-pills"> <li ng-class="{ active: tab===1 }"> <a href="" ng-click="tab=1">滑鼠墊</a> </li> <li ng-class="{ active: tab===2 }"> <a href="" ng-click="tab=2">馬克杯</a> </li> <li ng-class="{ active: tab===3 }"> <a href="" ng-click="tab=3">杯墊</a> </li> </ul> <div class="panel" ng-show="tab===1"> <h4>馬老師雲端研究室 滑鼠墊</h4> <p>產品介紹...</p> </div> <div class="panel" ng-show="tab===2"> <h4>馬老師雲端研究室 馬克杯</h4> <p>產品介紹...</p> </div> <div class="panel" ng-show="tab===3"> <h4>馬老師雲端研究室 杯墊</h4> <p>產品介紹...</p> </div> </section> </body> </html>
在看完了上面的案例之後,我們可以觀察到程式邏輯判斷的部分都是直接撰寫在HTML頁面上,那如果我們要把邏輯判斷的部分從HTML拆開寫到Javascript檔又應該要如何處理呢?首先,不用說的當然是必須要有應用程式的建立以及控制器囉!下圖中我們開始新增控制器,並且在section標籤中,輸入ng-controller=”panelController as panel”的屬性,相信在看了前幾篇教學的同學們對於這樣的項目是再熟悉不過了!接下來在控制器中,決定tab變數的初始值,就可以把原來的ng-init屬性刪除了。

在ng-click後去執行控制器中的selectTab函數,並且針對該函數帶入不同的值,利用帶入的值來改變tab變數值。

在ng-click後去執行控制器中的isSelected函數,也帶出不同的值給函數,讓函數可以回傳tab===1或2、3這樣的內容給ng-show使用。

這樣一來我們邏輯判斷的部分就會和網頁內容有所區隔,大家也可以透過JS Bin來測試這樣的程式結構。
<!DOCTYPE html> <html ng-app="store"> <head> <meta name="description" content="AngularJS Tabs Example 2"> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script> <script src="//code.jquery.com/jquery.min.js"></script> <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script> <meta charset="utf-8"> <title>AngularJS Tabs Example 2</title> </head> <body> <section ng-controller="PanelController as panel"> <ul class="nav nav-pills"> <li ng-class="{ active: panel.isSelected(1) }"> <a href="" ng-click="panel.selectTab(1)">滑鼠墊</a> </li> <li ng-class="{ active: panel.isSelected(2) }"> <a href="" ng-click="panel.selectTab(2)">馬克杯</a> </li> <li ng-class="{ active: panel.isSelected(3) }"> <a href="" ng-click="panel.selectTab(3)">杯墊</a> </li> </ul> <div class="panel" ng-show="panel.isSelected(1)"> <h4>馬老師雲端研究室 滑鼠墊</h4> <p>產品介紹...</p> </div> <div class="panel" ng-show="panel.isSelected(2)"> <h4>馬老師雲端研究室 馬克杯</h4> <p>產品介紹...</p> </div> <div class="panel" ng-show="panel.isSelected(3)"> <h4>馬老師雲端研究室 杯墊</h4> <p>產品介紹...</p> </div> </section> </body> </html>
(function(){ var app = angular.module('store', []); app.controller('PanelController', function(){ this.tab = 1; this.selectTab = function(setTab){ this.tab = setTab; }; this.isSelected = function(checkTab){ return this.tab === checkTab; }; }); })();
Why there’s a huge collection of vintage cars stored in the middle of the desert
base bridge
Back at the turn of the 21st century, Qatar was a country with few cultural attractions to keep visitors and residents entertained. Yet the Sheikh Faisal Bin Qassim Al Thani Museum — known as the FBQ Museum — was a place that most people visited as an alternative to the then-still rather ramshackle National Museum of Qatar.
You had to make an appointment, and drive out into the desert, getting lost a few times along the way, but then you were welcomed to the lush Al Samriya Farm with a cup of tea and some cake. The highlight was being allowed into a space crammed full with shelves and vitrines holding all sorts of eclectic artifacts from swords to coins — with the odd car and carriage standing in the grounds.
It wasn’t necessarily the kind of museum you’d find elsewhere in the world, but it was definitely a sight that needed seeing.
Today, it has grown and now claims to be one of the world’s largest private museums. It holds over 30,000 items, including a fleet of traditional dhow sailboats, and countless carpets. There’s also an entire house that once stood in Damascus, Syria.
There are archaeological finds dating to the Jurassic age, ancient copies of the Quran, a section that details the importance of pearling within Qatar’s history, and jewelry dating to the 17th century.
There are also items from 2022’s FIFA World Cup in Qatar including replica trophies, balls used in the games, entry passes, football jerseys and even shelves full of slightly creepy dolls and children’s plush animals.
Some of the more disturbing exhibits include various items of Third Reich paraphernalia in the wartime room, and, strangely enough, several showcases of birds’ legs with marking rings on them. Basically, whatever you can think of, you have a very good chance of finding it here.
Rumor even has it that behind a locked door is a room filled with the late Princess Diana’s dresses and other memorabilia, accessible only to a select few visitors. Another door hides a room, no longer open to the public, filled with collectibles of the late Saddam Hussein.
Everyone is talking about Greenland. Here’s what it’s like to visit
cow fi
A few months ago, Greenland was quietly getting on with winter, as the territory slid deeper into the darkness that envelops the world’s northerly reaches at this time of year.
But President Donald Trump’s musings about America taking over this island of 56,000 largely Inuit people, halfway between New York and Moscow, has seen Greenland shaken from its frozen Arctic anonymity.
Denmark, for whom Greenland is an autonomous crown dependency, has protested it’s not for sale. Officials in Greenland, meanwhile, have sought to assert the territory’s right to independence.
The conversation continues to intensify. A contentious March 28 visit to a US military installation by Usha Vance, the second lady, accompanied by her husband, Vice President JD Vance, was the latest in a series of events to focus attention on Trump’s ambitions for Greenland.
The visit was originally planned as a cultural exchange, but was shortened following complaints from Greenland Prime Minister Mute B. Egede.
Had the Vances prolonged their scheduled brief visit, they would’ve discovered a ruggedly pristine wildernesses steeped in rich Indigenous culture.
An inhospitable icecap several miles deep covers 80% of Greenland, forcing the Inuit to dwell along the shorelines in brightly painted communities. Here, they spend brutally cold winters hunting seals on ice under the northern lights in near perpetual darkness. Although these days, they can also rely on community stores.
The problem for travelers over the years has been getting to Greenland via time-consuming indirect flights. That’s changing. Late in 2024, the capital Nuuk opened a long-delayed international airport. From June 2025, United Airlines will be operating a twice-weekly direct service from Newark to Nuuk.
Two further international airports are due to open by 2026 — Qaqortoq in South Greenland and more significantly in Ilulissat, the island’s only real tourism hotspot.
While the Cumberland sample may contain longer chains of fatty acids, SAM is not designed to detect them. But SAM’s ability to spot these larger molecules suggests it could detect similar chemical signatures of past life on Mars if they’re present, Williams said.
convex finance
“Curiosity is not a life detection mission,” Freissinet said. “Curiosity is a habitability detection mission to know if all the conditions were right … for life to evolve. Having these results, it’s really at the edge of the capabilities of Curiosity, and it’s even maybe better than what we had expected from this mission.”
Before sending missions to Mars, scientists didn’t think organic molecules would be found on the red planet because of the intensity of radiation Mars has long endured, Glavin said.
Curiosity won’t return to Yellowknife Bay during its mission, but there are still pristine pieces of the Cumberland sample aboard. Next, the team wants to design a new experiment to see what it can detect. If the team can identify similar long-chain molecules, it would mark another step forward that might help researchers determine their origins, Freissinet said.
“That’s the most precious sample we have on board … waiting for us to run the perfect experiment on it,” she said. “It holds secrets, and we need to decipher the secrets.”
Briony Horgan, coinvestigator on the Perseverance rover mission and professor of planetary science at Purdue University in West Lafayette, Indiana, called the detection “a big win for the whole team.” Horgan was not involved the study.
“This detection really confirms our hopes that sediments laid down in ancient watery environments on Mars could preserve a treasure trove of organic molecules that can tell us about everything from prebiotic processes and pathways for the origin of life, to potential biosignatures from ancient organisms,” Horgan said.
Dr. Ben K.D. Pearce, assistant professor in Purdue’s department of Earth, atmospheric, and planetary sciences and leader of the Laboratory for Origins and Astrobiology Research, called the findings “arguably the most exciting organic detection to date on Mars.” Pearce did not participate in the research.
Arctic auroras
ethena
For getting around during winter, the Inuit here nowadays prefer snowmobiles, although they still keep their sled dogs. During winter they’ll offer intrepid visitors, wrapped up warm against the deep-freeze temperatures, dog-sledding jaunts. These can last either an hour or be part of expeditions over several days, sometimes with the added experience of learning how to build an igloo. Sisimiut on the west coast and Tasilaq in the southeast are active winter centers for dog sledding.
Winter’s most stellar attraction, though, is northern lights watching. With little urban light pollution, Greenland is a dark canvas for spectacular displays, and aurora borealis-watching vacations are becoming more popular.
Staying outdoors, Greenland is developing a reputation among adventure enthusiasts: from long-distance skiing expeditions and heliskiing on the icecap to hiking the 100-mile-long Arctic Circle Trail from Kangerslussuaq, where firearms need to be carried for warning shots in case of polar bear encounters.
Life is definitely changing here. The climate crisis is eating away at its icecap and Greenland may well end up as a pawn in a game of geopolitical chess. But for now, the bright glare of international attention should shine a favorable light on one of the wildest travel destinations on Earth.
Travel writer Mark Stratton is an Arctic specialist who has traveled to Greenland six times and counting. He’s marveled at the aurora borealis, sailed to Disko Island, dog-sledded with the Inuit, and once got stuck in an icefloe.
Профессиональный сервисный центр по ремонту бытовой техники с выездом на дом.
Мы предлагаем:сервис центры бытовой техники москва
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
desloratadine without prescription – buy desloratadine online cheap priligy 90mg usa
пин ап вход – пин ап зеркало
пинап казино – пин ап
Siham Haleem, a private tour guide for 15 years, says that Doha now has many world-class, modern museums — the National Museum of Qatar being a firm personal favorite. And yet he says that visiting Sheikh Faisal’s museum should still be on everybody’s to-do list.
simpleswap
“For those eager to learn about Qatar’s — and the region’s — heritage and beyond, the museum is an ideal destination,” he says. “Personally, I’m captivated by the car collection, the fossils, and especially the Syrian house, painstakingly transported and reassembled piece by piece.”
Stephanie Y. Martinez, a Mexican-American student mobility manager at Texas A&M University in Qatar likes the museum so much she includes it on all of her itineraries for students visiting from the main campus in Texas.
“The guided tours are very detailed, and the collections found at the museum have great variety and so many stories to unfold,” she says. “Truly, the museum has something to pique everyone’s interest. My favorites are the cars and the furniture exhibits showcasing wood and mother-of-pearl details. Definitely one of my favorite museums in Qatar, every time I visit I learn something new.”
Raynor Abreu, from India, also had praise for the unusual and immense collection.
“Each item has its own story, making the visit even more interesting,” he says. “It’s also impressive to know that Sheikh Faisal started collecting these unique pieces when he was very young. Knowing this makes the museum even more special, as it reflects his lifelong passion for history and culture.”
It takes time and dedication to truly examine the many collections within the museum — especially since most of them are simply on display without explanation.
Eclectic it may be, but it’s hard to fault the determination of Sheikh Faisal, who has brought together items that tell the story of Qatar and the Middle East.
Sarah Bayley, from the UK, says she visited the museum recently with her family, including 16 and 19-year-old teenagers, and was won over by its sheer eccentricity.
“Amazing. Loved it. It is a crazy place.”
Curiosity has maintained pristine pieces of the Cumberland sample in a “doggy bag” so that the team could have the rover revisit it later, even miles away from the site where it was collected. The team developed and tested innovative methods in its lab on Earth before sending messages to the rover to try experiments on the sample.
changelly
In a quest to see whether amino acids, the building blocks of proteins, existed in the sample, the team instructed the rover to heat up the sample twice within SAM’s oven. When it measured the mass of the molecules released during heating, there weren’t any amino acids, but they found something entirely unexpected.
An intriguing detection
The team was surprised to detect small amounts of decane, undecane and dodecane, so it had to conduct a reverse experiment on Earth to determine whether these organic compounds were the remnants of the fatty acids undecanoic acid, dodecanoic acid and tridecanoic acid, respectively.
The scientists mixed undecanoic acid into a clay similar to what exists on Mars and heated it up in a way that mimicked conditions within SAM’s oven. The undecanoic acid released decane, just like what Curiosity detected.
Each fatty acid remnant detected by Curiosity was made with a long chain of 11 to 13 carbon atoms. Previous molecules detected on Mars were smaller, meaning their atomic weight was less than the molecules found in the new study, and simpler.
“It’s notable that non-biological processes typically make shorter fatty acids, with less than 12 carbons,” said study coauthor Dr. Amy Williams, associate professor of geology at the University of Florida and assistant director of the Astraeus Space Institute, in an email. “Larger and more complex molecules are likely what are required for an origin of life, if it ever occurred on Mars.”
пин ап казино: https://pinupkz.life/
A long time in the making
Curiosity landed in Gale Crater on August 6, 2012. More than 12 years later, the rover has driven over 21 miles (34 kilometers) to ascend Mount Sharp, which is within the crater. The feature’s many layers preserve millions of years of geological history on Mars, showing how it shifted from a wet to a dry environment.
celer network
Perhaps one of the most valuable samples Curiosity has gathered on its mission to understand whether Mars was ever habitable was collected in May 2013.
The rover drilled the Cumberland sample from an area within a crater called Yellowknife Bay, which resembled an ancient lake bed. The rocks from Yellowknife Bay so intrigued Curiosity’s science team that it had the rover drive in the opposite direction to collect samples from the area before heading to Mount Sharp.
Since collecting the Cumberland sample, Curiosity has used SAM to study it in a variety of ways, revealing that Yellowknife Bay was once the site of an ancient lake where clay minerals formed in water. The mudstone created an environment that could concentrate and preserve organic molecules and trapped them inside the fine grains of the sedimentary rock.
Freissinet helped lead a research team in 2015 that was able to identify organic molecules within the Cumberland sample.
The instrument detected an abundance of sulfur, which can be used to preserve organic molecules; nitrates, which are essential for plant and animal health on Earth; and methane composed of a type of carbon associated with biological processes on Earth.
“There is evidence that liquid water existed in Gale Crater for millions of years and probably much longer, which means there was enough time for life-forming chemistry to happen in these crater-lake environments on Mars,” said study coauthor Daniel Glavin, senior scientist for sample return at NASA’s Goddard Space Flight Center in Greenbelt, Maryland, in a statement.
Iceberg flotillas
debridge finance
Located on the west coast, Ilulissat is a pretty halibut- and prawn-fishing port on a dark rock bay where visitors can sit in pubs sipping craft beers chill-filtered by 100,000-year-old glacial ice.
It’s a place to be awed by the UNESCO World Heritage Icefjord where Manhattan skyscraper-sized icebergs disgorge from Greenland’s icecap to float like ghostly ships in the surrounding Disko Bay.
Small boats take visitors out to sail closely among the bay’s magnificent iceberg flotilla. But not too close.
“I was on my boat once and saw one of these icebergs split in two. The pieces fell backwards into the sea and created a giant wave,” said David Karlsen, skipper of the pleasure-boat, Katak. “…I didn’t hang around.”
Disko Bay’s other giants are whales. From June to September breaching humpback whales join the likes of fin and minke whales feasting on plankton. Whale-watching is excellent all around Greenland’s craggy coastline.
Whales are eaten here. Visitors shouldn’t be surprised to encounter the traditional Greenlandic delicacy of mattak — whale-skin and blubber that when tasted is akin to chewing on rubber. Inuit communities have quotas to not only hunt the likes of narwhals but also polar bears, musk-ox and caribou — which can also appear on menus.
1vin 1vin .
Curiosity rover makes ‘arguably the most exciting organic detection to date on Mars’
bungee exchange
The NASA Curiosity rover has detected the largest organic molecules found to date on Mars, opening a window into the red planet’s past. The newly detected compounds suggest complex organic chemistry may have occurred in the planet’s past — the kind necessary for the origin of life, according to new research.
The organic compounds, which include decane, undecane and dodecane, came to light after the rover analyzed a pulverized 3.7 billion-year-old rock sample using its onboard mini lab called SAM, short for Sample Analysis at Mars.
Scientists believe the long chains of molecules could be fragments of fatty acids, which are organic molecules that are chemical building blocks of life on Earth and help form cell membranes. But such compounds can also be formed without the presence of life, created when water interacts with minerals in hydrothermal vents.
The molecules cannot currently be confirmed as evidence of past life on the red planet, but they add to the growing list of compounds that robotic explorers have discovered on Mars in recent years. A study detailing the findings was published Monday in the journal Proceedings of the National Academy of Sciences.
The detection of the fragile molecules also encourages astrobiologists that if any biosignatures, or past signs of life, ever existed on Mars, they are likely still detectable despite the harsh solar radiation that has bombarded the planet for tens of millions of years.
“Ancient life, if it happened on Mars, it would have released some complex and fragile molecules,” said lead study author Dr. Caroline Freissinet, research scientist at the French National Centre for Scientific Research in the Laboratory for Atmospheres, Observations, and Space in Guyancourt, France. “And because now we know that Mars can preserve these complex and fragile molecules, it means that we could detect ancient life on Mars.”
пин ап зеркало – пин ап казино зеркало
пин ап зеркало – пинап казино
пин ап вход: https://pinupkz.life/
Профессиональный сервисный центр по ремонту бытовой техники с выездом на дом.
Мы предлагаем:сервисные центры в москве
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
How to Swap Tokens on ApeSwap: A Complete Guide 2025
пин ап казино официальный сайт: https://pinupkz.life/
пин ап казино официальный сайт – пин ап зеркало
пин ап казино официальный сайт – пин ап вход
Профессиональный сервисный центр по ремонту бытовой техники с выездом на дом.
Мы предлагаем:сервисные центры по ремонту техники в мск
Наши мастера оперативно устранят неисправности вашего устройства в сервисе или с выездом на дом!
Generic100mgEasy viagra canada Sildenafil 100mg price
Generic 100mg Easy Generic100mgEasy buy generic 100mg viagra online
1 win kg https://www.fanfiction.borda.ru/?1-0-0-00029708-000-0-0-1743051664 .
пин ап – пин ап вход
мостбет вход cah.forum24.ru/?1-3-0-00000096-000-0-0-1743053764 .
пинап казино – пин ап зеркало