Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

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.

+ add another resource

Packages

Add Packages

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.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <head>
<!-- load bootstrap and our stylesheet -->
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <!-- \ lets you continue url on next line -->
	<style>
		body {padding-top: 50px;}
	</style>

	<!-- load angular and our custom application -->
	<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular.min.js"></script>
  
</head>
<!-- declare our angular application and angular controller -->
<body class="container" ng-app="firstApp" ng-controller="mainController as main">

<div class="jumbotron">
	<!-- display the list using ng-repeat -->
	<h2>This is my list</h2>
	<table class="table table-bordered">
		<thead>
			<tr>
				<td>Item</td>
				<td>Brand</td>
				<td>Quantity</td>
			</tr>
		</thead>
		<tbody>
        	<tr ng-repeat="item in main.shoppingList">
        		<td>{{ item.name }}</td>
        		<td>{{ item.brand }}</td>
        		<td>{{ item.quantity }}</td>
        	</tr>
		</tbody>
	</table>

	<!-- form to add grocery to the list -->
	<form class="form-inline" ng-submit="main.addItem()">
		<input type="text" class="form-control" placeholder="Peanut Butter" ng-model="main.shoppingData.name">
		<input type="text" class="form-control" placeholder="Skippy" ng-model="main.shoppingData.brand">
		<input type="number" class="form-control" placeholder="2" ng-model="main.shoppingData.quantity">

		<button type="submit" class="btn btn-success">Add</button> 
	</form>
</div>
</body>
              
            
!

CSS

              
                
              
            
!

JS

              
                angular.module('firstApp', [])

//information in this controller will be bound to itself using vm
.controller('mainController', function(){

	//It is a good practice to bind the parent this in the controller to vm
	//bind this to vm (view-model)
	var vm = this;

	//define variables and objects on this
	//this lets them be available to our views

	//define a list of items
	vm.shoppingList = [
	{name: 'Yogurt', brand: 'Chobani', quantity: 7},
	{name: 'Orange Juice', brand: 'Tropicana', quantity: 6},
	{name: 'Soy Milk', brand: 'Silk', quantity: 5},
	{name: 'Strawberry Jam', brand: 'Smuckers', quantity: 4}
	];

	//information that comes from our form
	vm.shoppingData = {};

	vm.addItem = function(){

		//add a grocery to the list
		vm.shoppingList.push({
			name: vm.shoppingData.name,
			brand: vm.shoppingData.brand,
			quantity: vm.shoppingData.quantity
		});

		//after our grocery has been added, clean the form
		vm.shoppingData = {};
	};
});


              
            
!
999px

Console