Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Register `hello` component, along with its associated controller and template
  2. angular.
  3.     module('hello').
  4.     component('hello', {
  5.         templateUrl: 'components/hello/hello.template.html',
  6.         controller: [ '$log', function Hello($log) {
  7.             this.name = 'world';
  8.  
  9.             this.countries = [
  10.                 {name: 'France', population: 63},
  11.                 {name: 'UK', population: 61}
  12.             ];
  13.  
  14.             this.uppercase = function uppercase() {
  15.                 this.name = this.name.toUpperCase();
  16.             }
  17.  
  18.             this.lowercase = function uppercase() {
  19.                 this.name = this.name.toLowerCase();
  20.             }
  21.  
  22.             this.remaining = function remaining() {
  23.                 $log.info("plop");
  24.                 return 10 - this.name.length;
  25.             }
  26.  
  27.             this.hasValidLength = function hasValidLength() {
  28.                 return this.name.length < 10;
  29.             }
  30.         }
  31.         ]
  32.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement