Protobuf in Angular

1,032 views
Skip to first unread message

Anno Nime

unread,
Oct 17, 2019, 2:01:47 PM10/17/19
to Angular and AngularJS discussion
I am not sure to be in the right place to ask this kind of question.


I am trying to replace json by protobuf in order to have more consistent communication from the front-end (Angular) to the back-end (Micro-services).


The only thing looking credible that I have found is:

https://github.com/sparten11740/angular-protobuf-example


However, this repository is quite old and it does not follow the structure the official documentation is based on.


My question is: is it possible to create a tutorial in the documentation (or somewhere else) that shows the steps from the `proto` file to the `ng serve` command to make it work? Ideally using `npm i google-protobuf` because it has 0 dependencies.


Again, I am not sure this the right place but I could not find a way to contact the Angular documentation team.

Sander Elias

unread,
Oct 18, 2019, 1:10:50 AM10/18/19
to Angular and AngularJS discussion
Hi Anno,

I have looked into protobuf a couple of times. There is not much you need for angular support. If you just create your js files, you can import those in any service, and use them there.
What browsers do you need to support? 
When the answer is "modern only" you can use the import function to lazy-load the compiled protobuf schema's. 
When you have those available during compile-time it's easier to just import those files.

The sample you linked does explain most of it correctly, aside from the point that at the time it was written, import could not handle those files. it can now.
I would not put the compiled results in assets unless they are highly dynamic, but instead put them somewhere in your app folder, and import them where needed.

Regards
Sander

Anno Nime

unread,
Oct 18, 2019, 8:12:41 AM10/18/19
to Angular and AngularJS discussion
Your comment did help me.

Arun Krishnan

unread,
Oct 18, 2019, 12:02:21 PM10/18/19
to ang...@googlegroups.com
Below are the transaction details

Sub Order ID: 907078Order ID: 10620534
my name arunemail is this samemobile no 8892964412

--
You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/angular/f2687041-bec5-49ed-9c09-e5369d52316c%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages