Last active
September 5, 2015 01:41
-
-
Save UnJavaScripter/b997ae77a65829f696f8 to your computer and use it in GitHub Desktop.
listaDeCosasPorHacer
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> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body ng-app="listaDeCosasPorHacer"> | |
La respuesta a la vida, el universo y todo es: {{7*6}} | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script> | |
<script> | |
angular | |
.module('listaDeCosasPorHacer', []); | |
</script> | |
</body> | |
</html> |
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> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body ng-app="listaDeCosasPorHacer"> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script> | |
<script> | |
// El primer parámetro es el nombre de la aplicación, debe ser igual al que definimos en | |
// la directiva ng-app. | |
// El segundo parámetro debe ser un array vació (allí se inyectarían las dependencias de | |
// la aplicación, si tuvieramos alguna). | |
// | |
// Un error muy común es no incluír el array vacío, sin él Angular no podrá reconocer | |
// la definición de la aplicación. | |
angular | |
.module('listaDeCosasPorHacer', []); | |
</script> | |
</body> | |
</html> |
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> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body ng-app="listaDeCosasPorHacer"> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script> | |
</body> | |
</html> |
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> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script> | |
</body> | |
</html> |
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> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body ng-app="listaDeCosasPorHacer"> | |
<!-- Lo que esté dentro de este div estará disponible para el controlador y viceversa --> | |
<div ng-controller="controladorPrincipal"> | |
<!-- Llamamos al elemento del controlador que definimos más abajo usando llaves dobles y omitiendo "$scope." --> | |
Aquí viene texto generado en el controlador: {{tareaNueva}} | |
</div> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script> | |
<script> | |
angular | |
.module('listaDeCosasPorHacer', []); | |
// Definimos el controlador como un hijo de la aplicación | |
// por eso la referenciamos nuevamente, pero | |
// **sin poner el array vacío después del nombre** como segundo parámetro | |
angular | |
.module('listaDeCosasPorHacer') | |
// En la definición del controlador primero va el | |
// nombre como string y luego el nombre de la | |
// función que lo representa | |
.controller('controladorPrincipal', controladorPrincipal); | |
// Pasamos $scope como argumento de la función, | |
// esto es inyección de dependencias. | |
// Si no lo pasaramos como argumento no lo podríamos usar | |
// dentro del controlador | |
function controladorPrincipal($scope){ | |
$scope.tareaNueva = 'Algo que me falta hacer'; | |
} | |
</script> | |
</body> | |
</html> |
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> | |
<html> | |
<head> | |
<title></title> | |
</head> | |
<body ng-app="listaDeCosasPorHacer"> | |
<div ng-controller="controladorPrincipal"> | |
<input ng-model="tareaNueva"> {{tareaNueva}} | |
</div> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.4/angular.min.js"></script> | |
<script> | |
angular | |
.module('listaDeCosasPorHacer', []); | |
angular | |
.module('listaDeCosasPorHacer') | |
.controller('controladorPrincipal', controladorPrincipal); | |
function controladorPrincipal($scope){ | |
$scope.tareaNueva = 'Algo que me falta hacer'; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment