Last active
August 29, 2015 14:27
-
-
Save gabrielfeitosa/d29d62de37e28449c01d to your computer and use it in GitHub Desktop.
Iniciando com Controller no AngularJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!--Declaração do módulo da aplicação--> | |
<html ng-app="app"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Exemplo 1 - Blog do Gabriel Feitosa</title> | |
</head> | |
<body> | |
<h1>Entendendo os Controladores</h1> | |
<!--Declaração do nosso MeuController--> | |
<div ng-controller="MeuController"> | |
<input type="text" ng-model="nome" placeholder="Diz teu nome aí" /> | |
<h1>Eita {{nome}}, o controlador setou o estado inicial do $scope.nome!</h1> | |
</div> | |
<footer> | |
<hr> | |
<a href="http://www.gabrielfeitosa.com"> Blog do Gabriel Feitosa</a> | |
</footer> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script> | |
<script> | |
//Declarando o módulo da aplicação | |
var app = angular.module('app', []); | |
//Declarando o construtor do MeuController | |
app.controller('MeuController', ['$scope', function($scope) { | |
$scope.nome = 'Gabriel'; | |
}]); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment