Golang和AngularJS模板冲突 [英] Golang and AngularJS template conflict

查看:101
本文介绍了Golang和AngularJS模板冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与golang html / template和angularjs分隔符有冲突。我知道有一种方法可以在Go中更改分隔符,但它不适用于我。也许应该在解析文件之前调用它?你能举个例子,说明它应该如何实现。



我发现很多AngularJS和Go应该没有冲突的评论,因为它们应该分开使用。据我所知,Go应该只用于后端(REST)。问题是,应该如何加载AngularJS,HTML?在这种情况下,我需要服务器吗?

解决方案AngularJS背后的想法是让所有渲染过程在客户端上运行如果你一直遵循这个逻辑,你不需要在服务器端的任何渲染(例如:没有调用 template.Execute )服务AngularJS html文件时,您只需提供静态内容。


I have a conflict with golang html/template and angularjs delimiters. I know that there is a method that lets to change delimiter in Go, but it does not work for me. Maybe it should be called before parsing of files? Could you please provide an example, how it should be implemented.

I found a lot of comments that AngularJS and Go should not have any conflict because they should be used separately. As I understand, Go should be used only for backend (REST). The question is, how AngularJS, HTML should be loaded? In this case, should I have to servers?

解决方案

The idea behind AngularJS is to have all the rendering process run on the client side.

If you follow this logic all along, you do not need any rendering on the server side (e.g : no call to template.Execute) when serving AngularJS html files, you simply have to serve static content.

这篇关于Golang和AngularJS模板冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆