<!DOCTYPE html>
<html ng-app="app">
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.min.js"></script>
<script src="script.js"></script>
</head>
<body ng-controller="PruebaController">
idioma = {{idioma}}
<br>
suma de 3 + 6 = {{suma}}
<br>
area = {{area}}
</body>
</html>
var app=angular.module("app",[]);
app.value("idioma","es-es");
app.value("matematicas_simples",{
sumar:function(a,b) {
return a+b;
},
restar:function(a,b) {
return a-b;
}
});
app.value("radio",10);
app.value("area",function(radio) {
return 3.1416*radio*radio;
})
app.controller("PruebaController",["$scope","idioma","matematicas_simples","radio","area",function($scope,idioma,matematicas_simples,radio,area) {
$scope.idioma=idioma;
$scope.suma=matematicas_simples.sumar(3,6);
$scope.area=area(radio);
}]);
ejemplo de value