HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URL's added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<html ng-app="ionicApp"><head><meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>Ionic Template</title>
<link href="//code.ionicframework.com/nightly/css/ionic.css" rel="stylesheet">
<script src="//code.ionicframework.com/nightly/js/ionic.bundle.js"></script>
</head>
<body ng-controller="MyCtrl">
<ion-content>
<ion-list>
<ion-item class="my-item" collection-repeat="airline in data.airlines"
collection-item-height="54"
>{{airline.name}}
</ion-item>
</ion-list>
<ion-infinite-scroll
on-infinite="fetchAirlines()"
distance="10%">
</ion-infinite-scroll>
</ion-content>
</body>
</html>
body {
cursor: url('https://ionicframework.com/img/finger.png'), auto;
}
.my-item{
left: 0;
right: 0;
}
var airlines = [{"fs":"LCI","iata":"LF","icao":"LCI","name":"Lao Central Airlines ","active":true},{"fs":"TGU","iata":"5U","icao":"TGU","name":"TAG","active":true},{"fs":"BT","iata":"BT","icao":"BTI","name":"Air Baltic","active":true},{"fs":"9J","iata":"9J","icao":"DAN","name":"Dana Airlines","active":true},{"fs":"2O","iata":"2O","icao":"RNE","name":"Island Air Service","active":true},{"fs":"NPT","icao":"NPT","name":"Atlantic Airlines","active":true},{"fs":"C8","iata":"C8","icao":"ICV","name":"Cargolux Italia","active":true},{"fs":"FK","iata":"FK","icao":"WTA","name":"Africa West","active":true},{"fs":"8K","iata":"8K","icao":"EVS","name":"EVAS Air Charters","active":true},{"fs":"W8","iata":"W8","icao":"CJT","name":"Cargojet","active":true},{"fs":"JBW","iata":"3J","icao":"JBW","name":"Jubba Airways (Kenya)","active":true},{"fs":"TNU","iata":"M8","icao":"TNU","name":"TransNusa","active":true},{"fs":"HCC","iata":"HC","icao":"HCC","name":"Holidays Czech Airlines","active":true},{"fs":"APJ","iata":"MM","icao":"APJ","name":"Peach Aviation","active":true},{"fs":"TUY","iata":"L4","icao":"TUY","name":"LTA","active":true},{"fs":"LAE","iata":"L7","icao":"LAE","name":"LANCO","active":true},{"fs":"L5*","iata":"L5","icao":"LTR","name":"Lufttransport","active":true},{"fs":"QA","iata":"QA","icao":"CIM","name":"Cimber","active":true},{"fs":"KBZ","iata":"K7","icao":"KBZ","name":"Air KBZ","active":true},{"fs":"L2","iata":"L2","icao":"LYC","name":"Lynden Air Cargo","active":true},{"fs":"MPK","iata":"I6","icao":"MPK","name":"Air Indus","active":true},{"fs":"CAO","icao":"CAO","name":"Air China Cargo ","active":true},{"fs":"BEK","iata":"Z9","icao":"BEK","name":"Bek Air","active":true},{"fs":"IAE","iata":"IO","icao":"IAE","name":"IrAero","active":true},{"fs":"GL*","iata":"GL","name":"Airglow Aviation Services","active":true},{"fs":"ATN","iata":"8C","icao":"ATN","name":"ATI","active":true},{"fs":"GU","iata":"GU","icao":"GUG","name":"Aviateca Guatemala","active":true},{"fs":"GHY","icao":"GHY","name":"German Sky Airlines ","active":true},{"fs":"SS","iata":"SS","icao":"CRL","name":"Corsair","active":true},{"fs":"XK","iata":"XK","icao":"CCM","name":"Air Corsica","active":true},{"fs":"W9*","iata":"W9","icao":"JAB","name":"Air Bagan","active":true},{"fs":"Z8*","iata":"Z8","icao":"AZN","name":"Amaszonas","active":true},{"fs":"D2","iata":"D2","icao":"SSF","name":"Severstal Aircompany","active":true},{"fs":"SNC","iata":"2Q","icao":"SNC","name":"Air Cargo Carriers","active":true},{"fs":"PST","iata":"7P","icao":"PST","name":"Air Panama","active":true},{"fs":"VV","iata":"VV","icao":"AEW","name":"Aerosvit Airlines","active":true},{"fs":"UJ","iata":"UJ","icao":"LMU","name":"AlMasria","active":true},{"fs":"9U","iata":"9U","icao":"MLD","name":"Air Moldova","active":true},{"fs":"NF","iata":"NF","icao":"AVN","name":"Air Vanuatu","phoneNumber":"678 238 48","active":true},{"fs":"NJS","iata":"NC","icao":"NJS","name":"Cobham Aviation","active":true},{"fs":"1B","iata":"1B","name":"British Airways Cargo","active":true},{"fs":"GEC","icao":"GEC","name":"Lufthansa Cargo ","active":true},{"fs":"CND","iata":"CD","icao":"CND","name":"Corendon Dutch Airlines","active":true},{"fs":"AI","iata":"AI","icao":"AIC","name":"Air India","active":true},{"fs":"TAH","icao":"TAH","name":"Air Moorea","active":true},{"fs":"AG","iata":"AG","icao":"ABR","name":"Air Contractors","active":true},{"fs":"AP","iata":"AP","icao":"ADH","name":"Air One","active":true},{"fs":"4G","iata":"4G","icao":"GZP","name":"Gazpromavia","active":true},{"fs":"RAC","icao":"RAC","name":"Ryukyu Air Commuter","active":true},{"fs":"NS","iata":"NS","icao":"HBH","name":"Hebei Airlines","active":true},{"fs":"J0","iata":"J0","icao":"JLX","name":"Jet Link Express","active":true},{"fs":"UMK","iata":"2N","icao":"UMK","name":"Yuzmashavia","active":true},{"fs":"EAK","iata":"6Z","icao":"EAK","name":"Euro-Asia Air","active":true},{"fs":"SE","iata":"SE","icao":"XLF","name":"XL Airways France","active":true},{"fs":"SHT","icao":"SHT","name":"British Airways Shuttle","active":true},{"fs":"NC","iata":"NC","icao":"NAC","name":"Northern Air Cargo","active":true},{"fs":"YB*","iata":"YB","icao":"BRJ","name":"Bora Jet","active":true},{"fs":"BGM","iata":"2B","icao":"BGM","name":"Ak Bars Aero","active":true},{"fs":"2L","iata":"2L","icao":"OAW","name":"Helvetic Airways","active":true},{"fs":"NE*","iata":"NE","icao":"NMA","name":"Nesma Airlines","active":true},{"fs":"PE*","iata":"PE","icao":"PEQ","name":"Pacific Air Express","active":true},{"fs":"AJI","iata":"7Z","icao":"AJI","name":"Ameristar Jet Charter","active":true},{"fs":"VJC","iata":"VJ","icao":"VJC","name":"VietJet Air","active":true},{"fs":"ACP","iata":"8V","icao":"ACP","name":"Astral Aviation","active":true},{"fs":"AB","iata":"AB","icao":"BER","name":"Air Berlin","active":true},{"fs":"ECO","iata":"8J","icao":"ECO","name":"EcoJet","active":true},{"fs":"ATV","icao":"ATV","name":"Avanti Air","active":true},{"fs":"SYA","iata":"FS","icao":"SYA","name":"Syphax Airlines","active":true},{"fs":"ETR","iata":"E4","icao":"ETR","name":"Estelar","active":true},{"fs":"XG","iata":"XG","icao":"SXD","name":"SunExpress Deutschland","active":true},{"fs":"MML","iata":"MR","icao":"MML","name":"Hunnu Air","active":true},{"fs":"CA","iata":"CA","icao":"CCA","name":"Air China","phoneNumber":"1-800-986-1985","active":true},{"fs":"3H","iata":"3H","icao":"AIE","name":"Air Inuit","active":true},{"fs":"WJ","iata":"WJ","icao":"LAL","name":"Air Labrador","active":true},{"fs":"AC","iata":"AC","icao":"ACA","name":"Air Canada","phoneNumber":"1-800-247-2262","active":true},{"fs":"MD","iata":"MD","icao":"MDG","name":"Air Madagascar","active":true},{"fs":"FJ","iata":"FJ","icao":"FJI","name":"Fiji Airways","phoneNumber":"1-800-227-4446","active":true},{"fs":"CW","iata":"CW","icao":"MRS","name":"Air Marshall Islands","phoneNumber":"1-692-625-3733","active":true},{"fs":"HAY","iata":"HK","icao":"HAY","name":"Hamburg Airways","active":true},{"fs":"TVP","iata":"3Z","icao":"TVP","name":"Travel Service Polska","active":true},{"fs":"VOE","iata":"V7","icao":"VOE","name":"Volotea","active":true},{"fs":"AMF","iata":"A8","icao":"AMF","name":"Ameriflight","active":true},{"fs":"U7","iata":"U7","icao":"UGB","name":"Air Uganda","active":true},{"fs":"VGO","iata":"E3","icao":"VGO","name":"NewGen Airways","active":true},{"fs":"TRQ","iata":"3T","icao":"TRQ","name":"Tarco Air","active":true},{"fs":"NZ","iata":"NZ","icao":"ANZ","name":"Air New Zealand","phoneNumber":"1-800-262-1234","active":true},{"fs":"PX","iata":"PX","icao":"ANG","name":"Air Niugini","active":true},{"fs":"YW","iata":"YW","icao":"ANE","name":"Air Nostrum","active":true},{"fs":"FL","iata":"FL","icao":"TRS","name":"AirTran","phoneNumber":"1-800-247-8726","active":true},{"fs":"XOJ","icao":"XOJ","name":"XOJET","active":true},{"fs":"WW*","iata":"WW","icao":"WOW","name":"WOW Air","active":true},{"fs":"BG","iata":"BG","icao":"BBC","name":"Biman Bangladesh Airlines","active":true},{"fs":"AS","iata":"AS","icao":"ASA","name":"Alaska Airlines","phoneNumber":"1-800-252-7522","active":true},{"fs":"EH","iata":"EH","icao":"AKX","name":"ANA Wings","active":true},{"fs":"BM","iata":"BM","icao":"BMR","name":"bmi Regional","active":true},{"fs":"B5","iata":"B5","name":"Fly SAX","active":true},{"fs":"JN*","iata":"JN","icao":"NLV","name":"New Livingston","active":true},{"fs":"S9","iata":"S9","icao":"IKM","name":"Starbow","active":true},{"fs":"BC","iata":"BC","icao":"SKY","name":"Skymark Airlines","active":true},{"fs":"OS","iata":"OS","icao":"AUA","name":"Austrian","active":true},{"fs":"LB*","iata":"LB","name":"Air Costa","active":true},{"fs":"CJ","iata":"CJ","icao":"CFE","name":"BA CityFlyer","active":true},{"fs":"BA","iata":"BA","icao":"BAW","name":"British Airways","phoneNumber":"1-800-AIRWAYS","active":true},{"fs":"0B","iata":"0B","icao":"BMS","name":"Blue Air","active":true},{"fs":"EVE","iata":"E9","icao":"EVE","name":"Evelop Airlines","active":true},{"fs":"C5","iata":"C5","icao":"UCA","name":"CommutAir","active":true},{"fs":"NT","iata":"NT","icao":"IBB","name":"Binter Canarias","active":true},{"fs":"KF","iata":"KF","icao":"BLF","name":"Blue1","active":true},{"fs":"D9","iata":"D9","icao":"DNV","name":"Donavia","active":true},{"fs":"JA","iata":"JA","icao":"BON","name":"B&H Airlines","active":true},{"fs":"CX","iata":"CX","icao":"CPA","name":"Cathay Pacific","active":true},{"fs":"SN","iata":"SN","icao":"BEL","name":"Brussels Airlines","active":true},{"fs":"I4*","iata":"I4","name":"Island Air Express","active":true},{"fs":"C6","iata":"C6","icao":"CJA","name":"CanJet Airlines","active":true},{"fs":"MU","iata":"MU","icao":"CES","name":"China Eastern Airlines","active":true},{"fs":"GK","iata":"GK","icao":"JJP","name":"Jetstar Japan","active":true},{"fs":"4C*","iata":"C4","icao":"CGK","name":"Click Airways","active":true},{"fs":"CL","iata":"CL","icao":"CLH","name":"Lufthansa CityLine","active":true},{"fs":"CN","iata":"CN","icao":"GDC","name":"Grand China Air","active":true},{"fs":"CZ","iata":"CZ","icao":"CSN","name":"China Southern Airlines","active":true},{"fs":"FIV","icao":"FIV","name":"CitationAir","active":true},{"fs":"AGY","iata":"EO","icao":"AGY","name":"Air Go Egypt","active":true},{"fs":"DE","iata":"DE","icao":"CFG","name":"Condor","active":true},{"fs":"A2","iata":"A2","icao":"CIU","name":"Cielos Del Peru","active":true},{"fs":"OK","iata":"OK","icao":"CSA","name":"CSA","active":true},{"fs":"GTA","iata":"E8","icao":"GTA","name":"City Airways","active":true},{"fs":"D7","iata":"D7","icao":"XAX","name":"AirAsia X","active":true},{"fs":"KEM","iata":"5Z","icao":"KEM","name":"CemAir","active":true},{"fs":"DTS","iata":"DH","icao":"DTS","name":"Douniah Airlines","active":true},{"fs":"EB","iata":"EB","icao":"PLM","name":"Pullmantur Air","active":true},{"fs":"U2","iata":"U2","icao":"EZY","name":"easyJet","active":true},{"fs":"EXT","icao":"EXT","name":"Nightexpress","active":true},{"fs":"KTK","icao":"KTK","name":"Katekavia","active":true},{"fs":"FTZ","iata":"FN","icao":"FTZ","name":"Fastjet","active":true},{"fs":"M4*","iata":"M4","icao":"SME","name":"Smart Aviation","active":true},{"fs":"NIN","iata":"6N","icao":"NIN","name":"Niger Airlines","active":true},{"fs":"7Z","iata":"7Z","icao":"HCV","name":"Halcyonair","active":true},{"fs":"HR","iata":"HR","icao":"HHN","name":"Hahn Air","active":true},{"fs":"OMT","iata":"CC","icao":"OMT","name":"CM Airlines","active":true},{"fs":"3R","iata":"3R","icao":"GAI","name":"Moskovia Airlines","active":true},{"fs":"GBQ","iata":"3G","icao":"GBQ","name":"Gambia Bird","active":true},{"fs":"M7","iata":"M7","icao":"MSL","name":"Marsland Aviation","active":true},{"fs":"JY","iata":"JY","icao":"IWY","name":"interCaribbean Airways","active":true},{"fs":"SPN","iata":"H8","icao":"SPN","name":"Sepahan Airlines","active":true},{"fs":"GV","iata":"GV","icao":"SMV","name":"Grant Aviation","active":true},{"fs":"PL*","iata":"PL","name":"Southern Air Charter","active":true},{"fs":"HTG","icao":"HTG","name":"Grossman Air Service","active":true},{"fs":"6P","iata":"6P","name":"Gryphon Airlines","active":true},{"fs":"H3","iata":"H3","name":"Harbour Air","active":true},{"fs":"HKI","icao":"HKI","name":"Hawkaire","active":true},{"fs":"HN*","iata":"HN","name":"Heavylift Cargo","active":true},{"fs":"YO","iata":"YO","icao":"MCM","name":"Heli Air Monaco","active":true},{"fs":"LIZ","iata":"Q9","icao":"LIZ","name":"Air Liaison","active":true},{"fs":"KH","iata":"KH","icao":"AAH","name":"Aloha Air Cargo","active":true},{"fs":"RJD","iata":"RG","icao":"RJD","name":"Rotana Jet","active":true},{"fs":"IB","iata":"IB","icao":"IBE","name":"Iberia","active":true},{"fs":"QX","iata":"QX","icao":"QXE","name":"Horizon Air","active":true},{"fs":"RQ","iata":"RQ","icao":"KMF","name":"Kam Air","active":true},{"fs":"IRQ","iata":"QB","icao":"IRQ","name":"Qeshm Air","active":true},{"fs":"CMV","iata":"3C","icao":"CMV","name":"Calima Aviacion","active":true},{"fs":"ID*","iata":"ID","icao":"BTK","name":"Batik Air","active":true},{"fs":"JC","iata":"JC","icao":"JEX","name":"JAL Express","active":true},{"fs":"P2","iata":"P2","icao":"XAK","name":"Airkenya","active":true}];
airlines.sort(function(a, b) {
var airlineA = a.name.toLowerCase();
var airlineB = b.name.toLowerCase();
if(airlineA > airlineB) return 1;
if(airlineA < airlineB) return -1;
return 0;
});
angular.module('ionicApp', ['ionic'])
.factory('FlightDataService', function($q, $timeout) {
var requestCounter = 0;
var requestLimit = 20;
var fetchAirlines = function() {
console.log('Fetching more airlines! Request Count=' + requestCounter++);
var start = requestCounter * requestLimit;
return $timeout( function(){
return airlines.slice( start , start + requestLimit );
}, 400);
};
return {
fetchAirlines : fetchAirlines,
}
})
.controller('MyCtrl', ['$scope', 'FlightDataService', function($scope, FlightDataService) {
$scope.data = { "airlines" : [] };
$scope.fetchAirlines = function() {
console.log('Requested more airlines');
FlightDataService.fetchAirlines().then(
function(airlines) {
$scope.data.airlines = $scope.data.airlines.concat(airlines);
console.log('There are ' + $scope.data.airlines.length + ' airlines in list');
$scope.$broadcast('scroll.infiniteScrollComplete');
}
)
};
$scope.fetchAirlines()
}]);
Also see: Tab Triggers