I'm trying to learn angular 1.5 component and have stumbled into a problem. The following code is my startup layout of my component, which compiles without errors with my gruntjob.
angular.module('layout',[]).component('kiHeaderParallax',{
controller: myController,
controllerAs: 'comp',
template:'<div>Yo</div>'
});
function myController(){
this.$postLink(domManipulation);
console.log('poop');
}
function domManipulation(){
console.log('poop2');
}
angular.element(document).ready(function() {
angular.bootstrap(document, ['layout']);
});
However I get this typeError when going to the browser:
> 1.angular-1.5.5.js:13550TypeError: this.$postLink is not a function
> at new myController (ki-header-parallax.component.ts:14)
> at Object.invoke (1.angular-1.5.5.js:4665)
> at $controllerInit (1.angular-1.5.5.js:10115)
> at nodeLinkFn (1.angular-1.5.5.js:9033)
> at compositeLinkFn (1.angular-1.5.5.js:8397)
> at compositeLinkFn (1.angular-1.5.5.js:8400)
> at compositeLinkFn (1.angular-1.5.5.js:8400)
> at publicLinkFn (1.angular-1.5.5.js:8277)
> at hint.js:1480
> at 1.angular-1.5.5.js:1751
I am using Angular 1.5.5 - so that shouldn't be the issue - any ideas why I can't get my log through?
The solution
this.$postLink = domManipulation;
instead of
this.$postLink(domManipulation);