Pen Settings

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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <html lang="pt-br">
	<meta charset="UTF-8">
	<title>Aprenda AngularJS - Formulário de Pedido</title>

	<link href="https://fonts.googleapis.com/css?family=Cookie|Open+Sans:400,700" rel="stylesheet">

	<!-- Arquivo CSS principal -->
	<link rel="stylesheet" href="style.css">

	<!--[if lt IE 9]>
		<script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>


<!-- Declare uma nova aplicação AngularJS e associe o controlador -->
<body ng-app ng-controller="OrderFormController">
			<!-- Percorre o array 'services', atribuindo um manipulador click, e defini ou remove a classe css "active" se necessário -->
			<li ng-repeat="service in services" ng-click="toggleActive(service)" ng-class="{ active:service.active }">
				<!-- Note o uso do 'current filter', que vai formatar o preço -->
				{{ service.name }} <span>{{ service.price | currency: "R$ " }}</span>

		<div class="total">
			<!-- Calcule o preço total de todas as escolhas de serviços. Formate isso como moeda -->
			Total: <span>{{ total() | currency:"R$ " }}</span>


	<!-- Include AngularJS from Google's CDN -->
	<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
	<script src="script.js"></script>
	Simples RESET


	Estilos Gerais

body {
	font: 15px/1.3 'Open Sans', sans-serif;
	color: #5E5B64;
	text-align: center;

a, a:visited {
	outline: none;
	color: #389DC1;

a:hover {
	text-decoration: none;

section, footer, header, aside, nav {
	display: block;

	Formulário de Pedido

form {
	background-color: #61A1BC;
	border-radius: 2px;
	box-shadow: 0 1px 1px #CCC;
	width: 400px;
	padding: 35px 60px;
	margin: 80px auto; 

form h1 {
	color: #FFF;
	font-size: 64px;
	font-family: 'Cookie', cursive;
	font-weight: normal;
	line-height: 1;
	text-shadow: 0 3px 0 rgba(0,0,0,0.1);

form ul {
	list-style: none;
	color: #FFF;
	font-size: 20px;
	font-weight: bold;
	text-align: left;
	margin: 20px 0 15px;

form ul li {
	padding: 20px 30px;
	background-color: #E35885;
	margin-bottom: 8px;
	box-shadow: 0 1px 1px rgba(0,0,0,0.1);
	cursor: pointer;

form ul li span {
	float: right;

form ul li.active {
	background-color: #8EC16D;

div.total {
	border-top: 1px solid rgba(255, 255, 255, 0.5);
	padding: 15px 30px;
	font-size: 20px;
	font-weight: bold;
	text-align: left;
	color: #FFF;

div.total span {

              function OrderFormController ($scope) {

	// Defina o modelo de propriedades. O View vai fazer o loop
	// através do array services e gerar um elemento li
	// para cada um dos itens.

	$scope.services = [
			name: 'Desenvolvimento Web',
			price: 3000,
			active: true
		}, {
			name: 'Design',
			price: 2000,
			active: false
		}, {
			name: 'Integração',
			price: 2500,
			active: false
		}, {
			name: 'Treinamento',
			price: 2200,
			active: false

	$scope.toggleActive = function (s) {
		s.active = !s.active;	

	// Método útil para calcular o preço total
	$scope.total = function () {

		var total = 0;

		// Uso o método auxiliar do Angular 'forEach'
		// para iterar o array services

		angular.forEach ($scope.services, function (s) {
			if (s.active) {
				total += s.price;

		return total;

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.