Skip to content

Instantly share code, notes, and snippets.

@empirefx
Created April 11, 2014 01:05
Show Gist options
  • Save empirefx/10435405 to your computer and use it in GitHub Desktop.
Save empirefx/10435405 to your computer and use it in GitHub Desktop.
AngularJS easy way..
<!doctype html>
<html data-ng-app="prueba">
<meta charset="utf-8"/>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular-route.js"></script>
<script type="text/javascript">
var probando = angular.module("prueba", ['ngRoute']);
probando.config(function($routeProvider) {
$routeProvider
.when('/',
{
controller:'ListCtrl',
templateUrl:'items.html'
})
.otherwise({redirectTo:'/'});
});
probando.controller('ListCtrl', function($scope) {
//$scope.message = '...';
});
</script>
</head>
<body>
<h2>Prueba</h2>
<div data-ng-view="">Vista aqui..</div>
</body>
</html>
<h1>Items</h1>
<p>Cargado <i>items.html</i></p>
<script type="text/javascript">
alert('Hola!');
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment