Created
March 17, 2016 18:09
-
-
Save AlexanderArmua/ebbcab36fa39721f6025 to your computer and use it in GitHub Desktop.
Alias para los controllers
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
.controller('pruebaAppCtrl', function($rootScope){ | |
var self = this; | |
self.otroDato = "Esto está ahora en el scope, para acceder a través de un alias"; | |
//Se lo declara en this, de modo que solo se podra llamar a través de un alias- | |
}); |
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
<div ng-controller="pruebaAppCtrl as vm"> | |
<p>{{vm.dato}}</p><!--Se lo llama a travez de "vm."--> | |
</div> | |
<!--Esto permite asignarle un alias a un conttoller, y si se da el caso de que quede un controller dentro de otro controller, | |
se puede llamar a travez de un alias y evitar confuciones para llamar diferentes variables--> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment