Created
February 18, 2016 18:30
-
-
Save leandroh/bfaf526b84da2abf8409 to your computer and use it in GitHub Desktop.
Exemplo simples de uma pequena diretiva em AngularJS
This file contains hidden or 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> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Bem vindo ao mundo das diretivas no AngularJS!</title> | |
| </head> | |
| <body ng-app="app"> | |
| <minha-diretiva></minha-diretiva> | |
| <script src="https://code.angularjs.org/1.5.0/angular.min.js"></script> | |
| <script> | |
| (function() { | |
| 'use strict'; | |
| angular.module('app', []); // Cria nosso módulo principal | |
| // Cria uma diretiva tendo como parametros uma string e uma function | |
| angular.module('app') | |
| .directive('minhaDiretiva', function() { | |
| return { | |
| template: '<div>Bem vindo ao mundo das diretivas!</div>' // Opção de template | |
| } | |
| }); | |
| })(); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment