Last active
September 21, 2015 09:49
-
-
Save yngvebn/0278734dacdf356eceff to your computer and use it in GitHub Desktop.
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
angular.module('app', []); |
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
function MyComponent(TestService){ | |
var vm = this; | |
this.greeting =TestService.greet(); | |
console.log('We have a component'); | |
} | |
MyComponent.templateUrl = 'test.tpl.html' | |
MyComponent.selector = 'my-new-component'; | |
MyComponent.scope = { | |
value : '=' | |
} | |
angular.module('app').component(MyComponent); |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.js"></script> | |
<script src="app.js"></script> | |
</head> | |
<body ng-app="app"> | |
<my-new-component value="'I was provided!'"></my-new-component> | |
</body> | |
</html> |
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
angular.module('app').service('TestService', function(){ | |
this.greet = function(){ | |
return 'Hello from service'; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment