• Register
0 votes
269 views

Problem :

I am beginner to Angular 2. Currently I am trying to learn more about the server rendering with the help of Angular2, I am trying to use the gulp instead of webpack. But my problem is when my server starts then I start facing below error :

/Users/mphil/IdeaProjects/trails-angular2-isomorphic/node_modules/@angular/core/src/util/decorators.js:165
        throw 'reflect-metadata shim is required when using class decorators';
        ^
reflect-metadata shim is required when using class decorators

I have also tried some solutions mentioned online but they are not working on my code. How can I fix my code ?

8 4 2
2,300 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I was reading few questions and I came across your question here. I had also faced the similar issue recently. I can give you some solutions for your issue just check if they can fix your error as below.

You can try to add the import 'reflect-metadata'; to your server.ts file as it will help you in server rendering. After adding that small line of code my errors got fixed.

You can also try add the div tag. Similar to the directive the component HTML tag should be enclosed in the div tag as shown below

<div>
//html
</div>

When you will enclose your .HTML tag in div as shown above then your errors will be fixed.

5 2 1
4,980 points

Related questions

0 votes
1 answer 2 views
2 views
Problem: I have a strange error. Usually (I did my googling), in this case of errors Angular specifies in square brackets which exactly module/service/provider/etc caused the problem. However here, it says only options. Can someone help me?
asked 4 days ago Supti 12.7k points
0 votes
1 answer 248 views
248 views
Problem: I am naive to Angular, Webpack, Bootstrap and typescript. I have tried to write a service but it is throwing the below error while my app is bootstrapping. I am currently using ng2 2.4.2 and the angular-cli 1.0.0-beta.24. My TypeError as below: &ldquo;Uncaught typeerror: ... .navigate(['/project', query]); } public extractData(res: Response) { let body = res.json(); return body || {}; } }
asked Sep 3, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 321 views
321 views
Problem: Recently I have joined the angular2 project. But now I am stuck with below listed errors. The errors occurred if I tried to send my JSON objects to my backend. It may be due a parsing of my JSON objects. I am very new to angualar so unable to find ... (core.umd.js:3971) at ZoneDelegate.invokeTask (zone.js:274) at Zone.runTask (zone.js:151) at XMLHttpRequest.ZoneTask.invoke (zone.js:345)
asked Aug 5, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 4 views
4 views
Problem: I know there is lot of answers for the above issue with small difference 'directive' instead of ngChange. I am using 1.7.2 version. Here is my code <select class="full-width" id="searchWithSavedFilter" ng-modal="searchWithSavedFilter" ng-change="test( ... angularjs reference code is <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.2/angular.min.js"></script>
asked 4 days ago padma1 34.3k points
0 votes
1 answer 8 views
8 views
Problem Can anyone tell what could be the serve command required to be run in an angular project ?
asked Apr 6 salim1 60.6k points
0 votes
1 answer 7 views
7 views
Problem: I have multiple components which require the same dependency which requires a string for the constructor. How can I tell angular2 to use a specific instance of the type for DI?
asked Mar 10 ummesalma 29.2k points
0 votes
1 answer 4 views
4 views
Problem: I'm trying to share data across controllers. Use-case is a multi-step form, data entered in one input is later used in multiple display locations outside the original controller. HTML <div ng-controller="FirstCtrl"> <input type="text" ng-model="FirstName"><!-- ... ){ }); // Step 2 Controller myApp.controller('SecondCtrl', function( $scope, Data ){ $scope.FirstName = Data.FirstName; });
asked Apr 23 Jack20 5.1k points
0 votes
1 answer 353 views
353 views
Problem : I am beginner to Angular. I have recently started to use the ng serve but now I continuously get below error. &ldquo;A bad http response code (404) was received when fetching the script.&rdquo; I have already tried to do lot of research on it but still I don&rsquo;t have any solution on it. Can somebody help me in resolving the errors ?
asked Mar 5, 2020 mphil 2.3k points
0 votes
1 answer 44 views
44 views
Problem: I am having issues with " appears in the ngmodule.imports of appmodule, but could not be resolved to an ngmodule class &rdquo;. Any recomendation on how to solve this?
asked Apr 6 munim01 21k points