TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Simple visual JSON editor as an AngularJS directive

15 点作者 mb2100超过 11 年前

2 条评论

diggan超过 11 年前
Since the author wasn&#x27;t nice himself to link the Github repository, I will. <a href="https://github.com/mb21/JSONedit/" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mb21&#x2F;JSONedit&#x2F;</a><p>* You should create a new global variable called &quot;app&quot;[1], that&#x27;s bad because it will create collisions with other stuff.<p>* The directives.js contains other directives than just the json thing[2] . Are they meant to be used with the jsonedit or is it something for the demo?<p>* The directive have a lot of things to do. You can notice that when you have HTML and a mixed stuff in the directive. Try taking all the calculations, parsing and actual functionality that have with the data to do, and move in into a provider. Let the directive only handle how to show and interact with stuff. You should have a read about separation of concerns[4] and single responsibility principle[5].<p>Other than that, I like the idea and I would use this when debugging stuff in my AngularJS, if it were easier the actually include. It seems to be dependent on Angular UI for some strange reason. Handy that you can edit the data live. Nice work!<p>[1] <a href="https://github.com/mb21/JSONedit/blob/gh-pages/js/directives.js#L1" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mb21&#x2F;JSONedit&#x2F;blob&#x2F;gh-pages&#x2F;js&#x2F;directives...</a><p>[2] <a href="https://github.com/mb21/JSONedit/blob/gh-pages/js/directives.js#L12-L27" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mb21&#x2F;JSONedit&#x2F;blob&#x2F;gh-pages&#x2F;js&#x2F;directives...</a> and <a href="https://github.com/mb21/JSONedit/blob/gh-pages/js/directives.js#L31-L38" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mb21&#x2F;JSONedit&#x2F;blob&#x2F;gh-pages&#x2F;js&#x2F;directives...</a><p>[3] <a href="https://github.com/mb21/JSONedit/blob/gh-pages/js/directives.js#L166-L239" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mb21&#x2F;JSONedit&#x2F;blob&#x2F;gh-pages&#x2F;js&#x2F;directives...</a><p>[4] <a href="https://en.wikipedia.org/wiki/Separation_of_concerns" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Separation_of_concerns</a><p>[5] <a href="https://en.wikipedia.org/wiki/Single_responsibility_principle" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Single_responsibility_principl...</a>
评论 #6386503 未加载
lfuller超过 11 年前
Is it just me, or do all these visual editors that have been popping up on Hacker News lately seem to be more difficult to read than Vanilla JSON?<p>One of the main founding concepts being JSON was to make a human-readable data representation. It may just be because I work with it on a daily basis, but I find that it&#x27;s one of the best data formats for fast and simple readability. I find myself spending more time figuring out what&#x27;s going on in these visual JSON editors than if I was simply reading the JSON directly.
评论 #6386515 未加载