Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Iniciando com Controller no AngularJS - Adicionando comportamento ao $scope
<!DOCTYPE html>
<html ng-app="app">
<meta charset="utf-8" />
<title>Exemplo 2 - Blog do Gabriel Feitosa</title>
<h1>Entendendo os Controladores</h1>
<div ng-controller="MeuController">
<input type="text" ng-model="item" placeholder="Informe um item" />
<button ng-click="addItem()">Adicionar</button>
<h1> Itens</h1>
<li ng-repeat="i in itens">{{i}}</li>
<a href=""> Blog do Gabriel Feitosa</a>
<script src=""></script>
var app = angular.module('app', []);
app.controller('MeuController', ['$scope', function($scope) {
$scope.item = '';
$scope.itens = [];
$scope.addItem = function() {
$scope.item = '';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment