Skip to content

Instantly share code, notes, and snippets.

View AFelipeTrujillo's full-sized avatar

Andrés Felipe Trujillo AFelipeTrujillo

View GitHub Profile
<div ng-app="app" ng-controller="controller">
<div>
<input type="number" ng-model="number" />
<button ng-click="square()">
Square
</button>
</div>
<div>
Result: {{result}}
</div>
app.service('Calc',function(MathFactory){
this.square = function(a){
return MathFactory.multiply(a,a);
}
})
var app = angular.module('app',[]);
app.factory('MathFactory',function(){
var factory = {};
factory.add = function(a,b){
return a + b;
}
factory.subtraction = function(a,b){
return a - b;
<div ng-app="app" ng-controller="geomeetricShapesController">
<div>
Title: <b>{{title}}</b>
</div>
<hr />
<div ng-controller="circleController">
<div>
Name: {{name}} - {{title}}
</div>
<div>
app.controller('circleController',function($scope){
$scope.name = "Circle";
$scope.formula = "A = PI * r ^ 2";
$scope.area = function(){
return Math.PI * Math.pow($scope.radius,2)
}
});
<div ng-app="app">
<div ng-controller="addController">
<a href="#add">Add</a>
<a href="#create">Create</a>
<a href="#update">Update</a>
<hr />
<div ng-view></div>
</div>
<!-- View List -->
<script type = "text/ng-template" id = "add.htm">
<div ng-app = "app">
<script type = "text/ng-template" id = "agregarEstudiante.htm">
<h2> Agregar Estudiante </h2>
{{mensaje}}
</script>
</div>
<div ng-app = "mainApp">
<div ng-view></div>
</div>
<div ng-app="app" ng-controller="userController">
<table border="1">
<tr>
<th>ID</th>
<th>First Name</th>
<th>Last Name</th>
</tr>
<tr ng-repeat="value in users">
<td>{{value.id}}</td>
<td>{{value.firstName}}</td>
<div ng-app = "" ng-controller = "EstudianteControlador">
<div ng-include = "'principal.htm'"></div>
<div ng-include = "'asignaturas.htm'"></div>
</div>