Reputation: 3811
I'm trying to use Angular 1.5.0-beta.0
which I have installed from npm
.
According to some guides - we can now create a component using module.component
instead of the old fashion module.directive
.
This is the component code:
export default angular.module('app.components.header', [])
.component('dashboardHeader', {
controller: 'HeaderCtrl as headerCtrl',
template: `This is test.`
})
;
My html is:
<body>
<dashboard-header></dashboard-header>
<div ui-view="content">
</body>
I'm getting:
angular.module(...).component is not a function
What could be the problem?
Upvotes: 8
Views: 14317
Reputation: 549
I had the same issue for meteor js (AngularJs with MeteorJs) . We need to update the angularjs version.In my case I updated 1.4.8 to 1.5.3 then restarted the meteor server, error solved.
Command to update angular js(In case of meteor)
meteor update angular:angular - this will update the angularjs to the latest version available.
Upvotes: 0
Reputation: 101
I had the same issue did a
bower install angular
it still gave the same error ,
Finally I updated the version of angular.js in script src tag and it worked .
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
Upvotes: 8
Reputation: 3330
There is nothing wrong with your code. Install the stable release of angular 1.5. I had the same problem and then deleted angular and installed it with:
bower install angular
Upvotes: 6