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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Angular 9.0

248 点作者 theodorejb超过 5 年前

24 条评论

tony超过 5 年前
One of the nice things that Angular has you don&#x27;t see in the post is... <i>very</i> polite and courteous maintainers! <a href="https:&#x2F;&#x2F;github.com&#x2F;angular&#x2F;angular&#x2F;pull&#x2F;33717#issuecomment-553118863" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;angular&#x2F;angular&#x2F;pull&#x2F;33717#issuecomment-5...</a><p>This was a fast release cycle. It was back in November 2019 we were talking about 3.7, and now it&#x27;s in.<p>I&#x27;m not even thinking about Ivy. But it&#x27;s nice to have all the nice comforts of typescript ready and working out of the box. (I mainly work in React, but dabble with angular&#x2F;vue to stay up to date)<p>And what a smooth update process (abbreviated):<p><pre><code> ng update @angular&#x2F;cli @angular&#x2F;core ** Executing migrations of package &#x27;@angular&#x2F;cli&#x27; ** ** Executing migrations of package &#x27;@angular&#x2F;core&#x27; ** Your project has been updated to Angular version 9! For more info, please see: https:&#x2F;&#x2F;v9.angular.io&#x2F;guide&#x2F;updating-to-version-9</code></pre>
评论 #22263106 未加载
评论 #22267278 未加载
Phenix88be超过 5 年前
After 2 years of Angular madness I will send my resignation and I hope I will never work with it again.<p>My app is a big stack of workaround stuff that might break anytime. Because that is how angular work. Some stuff work in a context and doesn&#x27;t in an other. Nobody&#x27;s know why ! They have so much issue on Github that they need a bot to close them after a while. They hope the bug disappear by himself ?
评论 #22265553 未加载
评论 #22264456 未加载
评论 #22264304 未加载
评论 #22264209 未加载
评论 #22266556 未加载
评论 #22264501 未加载
gitgud超过 5 年前
The only thing I like about Angular is the dependency injection of services. Having &quot;services&quot; managed for you and just picking and choosing what you want is pretty nice.<p>What I don&#x27;t like is the verbosity and boilerplate... here&#x27;s 2 examples:<p>- Routing boilerplate is convoluted and time consuming. I think Nuxt.js has a much nicer implementation of SPA routing, where the filesystem is used to map the routes.<p>- Angular modules are verbose, redundant and don&#x27;t even truely encapsulate dependencies anyway. You can easily create implicit dependencies by relying on services instantiated in higher level modules.... which is bad<p>I love using Typescript though!
评论 #22264311 未加载
评论 #22264180 未加载
theodorejb超过 5 年前
I just updated my mid-size app from v8.2 to v9 with Ivy, and the total es2015 bundle size decreased from 973 KB to 669 KB. An over 31% improvement with no effort on my part!
评论 #22262521 未加载
评论 #22262286 未加载
pier25超过 5 年前
Will be interesting to see how it fares in the Js Benchmarks:<p><a href="https:&#x2F;&#x2F;krausest.github.io&#x2F;js-framework-benchmark&#x2F;current.html" rel="nofollow">https:&#x2F;&#x2F;krausest.github.io&#x2F;js-framework-benchmark&#x2F;current.ht...</a>
评论 #22262397 未加载
评论 #22262756 未加载
rsinger87超过 5 年前
Huge thanks Angular team. A few years ago, my team desperately needed to pick and run with a frontend framework. After a couple months to learn the Angular fundamentals, we haven&#x27;t looked back. We find the framework to be extremely intuitive and flexible enough to handle any scenario we&#x27;ve encountered. The productivity wins have been enormous. We have about a dozen apps and anyone on our small team can jump into any project and contribute. I can&#x27;t imagine how fractured our knowledge would be if we had to stitch together multiple libraries and come up with our own constructs.
tashoecraft超过 5 年前
Huge release with a lot of time and effort put into it. Congrats to the angular team. Couldn’t imagine another framework putting in the amount of work they did in order to insure Ivy goes well.
评论 #22262744 未加载
doczoidberg超过 5 年前
Just want to say that all the Angular React comparisons are dumb. It is comparing apples to oranges. Angular is a bigger framework for developing more complex stuff. Therefore of course there is a steeper learning curve. Here are comments like &quot;react is so much more easier because it is just functions&quot;. Why not just using vanilla js because you have nothing to learn then? Or just use binary code? It is just 0 and 1.
评论 #22267482 未加载
评论 #22274606 未加载
评论 #22267971 未加载
dfsegoat超过 5 年前
Is there still a clear path from angularjs 1.x onto angular 9.0? Anyone done it recently?<p>Supporting a large 1.x codebase right now, and would love to start incrementally moving to angular.
评论 #22263535 未加载
评论 #22263383 未加载
评论 #22263333 未加载
评论 #22263409 未加载
评论 #22263600 未加载
thallukrish超过 5 年前
I have spent a lot of time in Angular 2 and later in Angular 6. I had later switched to plain java script and used requireJS to modularize. I have my own orchestrator to route events like a pub-sub. HTML5 + CSS + plain JS is good enough for most simple UI.
评论 #22265613 未加载
评论 #22264694 未加载
mnm1超过 5 年前
How often do they release major versions? It seems every few months there&#x27;s a new major version update. Having been burned once with angular, combined with this aggressive release schedule, by themselves are enough to make me not even consider angular. It could be the greatest framework in the world and I still wouldn&#x27;t consider it. Not everyone is building throwaway prototypes and garbage startup code. Many people need stable libraries and frameworks that last many years and don&#x27;t need time consuming updates and migrations constantly. Angular is clearly not this.
qwerty456127超过 5 年前
Why is Angular so less popular than React?
评论 #22262450 未加载
评论 #22263387 未加载
评论 #22262471 未加载
评论 #22262356 未加载
评论 #22262350 未加载
评论 #22263069 未加载
评论 #22264022 未加载
评论 #22264406 未加载
评论 #22262373 未加载
评论 #22262342 未加载
评论 #22266099 未加载
评论 #22262888 未加载
评论 #22263114 未加载
评论 #22262381 未加载
评论 #22262662 未加载
Yuioup超过 5 年前
I have a policy of only shipping &quot;back-end&quot; apps because I&#x27;m worried about performance, browser compatibility and SEO. I don&#x27;t know if the situation has improved in Angular 9.<p>Does anybody here use Angular for their customer facing websites?
评论 #22264011 未加载
评论 #22266016 未加载
评论 #22264190 未加载
rawoke083600超过 5 年前
I&#x27;ve been running the RC&#x27;s at least the last 6 months or more, upgrading usually within in day when the new one comes out. I&#x27;ve been impressed but what I&#x27;ve seen is that even though A9 is very good (Well done developers) when the real world hit you and your app. Its many times all the other nonsense you have to include in your app that makes it big and slow (GAnalytics,GAdsense, fb-pixel, crazyegg and and and) Still wouldn&#x27;t want to code without it !:)
annnoo超过 5 年前
There are no words on ESLint instead of the deprecated TSLint... :&#x2F; Would really like to do the switch, but official support by Angular is more important at my company.
评论 #22265445 未加载
5cott0超过 5 年前
What % of angular apps in production are &lt;= 1.5?
eternalny1超过 5 年前
I tried updating to Angular v9 from v8 and am getting an error regarding strict mode and a &quot;with&quot; statement.<p>Anyone have any ideas?<p><a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;60114758&#x2F;uncaught-syntaxerror-strict-mode-code-may-not-include-a-with-statement" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;60114758&#x2F;uncaught-syntax...</a>
tommyjepsen超过 5 年前
I just upgraded and got &#x27;Failed to load module script: The server responded with a non-JavaScript MIME type of &quot;text&#x2F;plain&quot;.&#x27; from my S3 through CloudFront.<p>Seems like it&#x27;s not adding &#x27;type=&quot;text&#x2F;javascript&quot;&#x27; to &lt;script&gt; in index.html. When adding this manually, everything works.<p>Just FYI if others upgrade and seem to get the same errors.
评论 #22262724 未加载
评论 #22262629 未加载
no_wizard超过 5 年前
Anyone know what the real world sizes of the bundles are now? Last I used Angular I couldn’t get a bundle smaller than like 250-300kb
评论 #22264555 未加载
sgt超过 5 年前
Angular 9 is out? The other day I thought version 4 was the latest one. It sure moves fast!
radiKal07超过 5 年前
What about AngularDart?
评论 #22264044 未加载
EGreg超过 5 年前
Can someone here please do a serious overview comparing the latest:<p><pre><code> Angular React Web Components </code></pre> Things are changing so quickly, I just wanted to sort of have an overview for those of us who don’t work with these frameworks daily.<p><a href="https:&#x2F;&#x2F;blog.usejournal.com&#x2F;web-components-will-replace-your-frontend-framework-3b17a580831c" rel="nofollow">https:&#x2F;&#x2F;blog.usejournal.com&#x2F;web-components-will-replace-your...</a><p>Can Web Components pretty much do everything without a framework now? I think Ionic moved to it for example. If we already have our own code for loading and rendering components, using Handlebars templates, what would we need to do to make them into web components instead, or make all of ours compatible with the latest React or Angular?<p><i>The specifics for anyone who cares:</i><p>When we began our own framework, way before React and Angular, we built our own, kinda “sane” reusable component engine. We called them “tools”. One tool on an element is a component. But you could also add multiple tools on a component, to add or remove behaviors:<p><a href="https:&#x2F;&#x2F;qbix.com&#x2F;platform&#x2F;guide&#x2F;tools" rel="nofollow">https:&#x2F;&#x2F;qbix.com&#x2F;platform&#x2F;guide&#x2F;tools</a><p>Basically, we figured it would be easier to just let Templates, HTML, CSS and JS each do what they were intended for.<p><i>HTML side</i><p>1. We had &lt;div class=“Q_Tool Streams_chat_tool” data-streams-chat=‘{“foo”: bar, ...}’&gt; easily exporting json from php or templating engines, very readable and completely standard (no JSX or custom components). It was just slightly longer to write but provided useful metadata. It used to be called <i>microformats</i> back in the day. Multiple tools can be added on same element this way. The element didnt have to be a div.<p>2. We had handlebars helpers like {{&amp;tool “Streams&#x2F;chat” foo=bar}} and Q.Tool.setUpElement(“div”, toolName, options), or pass an element instead of “div” to add a tool on an existing element. We also had a jQuery fn method like $(“foo”).tool(“Streams&#x2F;chat”, options).activate() .<p>3. Our users just called var element = Q.activate(Q.Tool.setUpElement(“div”))) in vanilla JS or $(“&lt;div &#x2F;&gt;”).tool(...).activate() if jQuery was loaded.<p>* CSS side*<p>1. We namespaced our CSS by Modulename_toolname_<p>2, Some tools took advantage of shared CSS classes defined in the module or a module they depend on<p><i>Javascript side</i><p>1. We just had Q.Tool.define(toolName, constructor, defaultOptions, methods) and the tool.state would be the options merged over the defaultOptions. It was all customizable and merging was done via a smart Q.extend() function that we tweaked to eg combine Q.Event handlers in the best way.<p>2. Ways to access tools on an element would include Q.Tool.byId() and element.Q.tools etc. The tool ids would be autogenerated so as to establish a hierarchy of which tool was a parent. Then you could do tools.children([filterName]) and tools.parents() and so on. Traverse faster without touching the DOM.<p>3. We had Q.activate(container, options) to activate tools within a certain container. Javascript for tools would be loaded on demand, and tools would be added&#x2F;removed on demand. We had Q.Event.prototype.add(callback, key) take a String key or a Q.Tool, so events would be automatically removed when a tool was removed.<p>4. You could also do Q.Tool.define([toolName1, toolName2], toolName, constructor, defaultOptions, methods) to have tools require that previously named tools already be activated on the element. This is for composability of tools, something more general than inheritance. Let’s say you have a chatroom and you want to add support for @mentions to it and <a href="https:&#x2F;&#x2F;linkscraping.com" rel="nofollow">https:&#x2F;&#x2F;linkscraping.com</a> as you type. So you’d make tools that work in top of Streams&#x2F;chat.<p>It seems to me that ANYWAY your user will have to load a Javascript file that defined your web components. And ANYWAY they will have to load javascript on demand. And ANYWAY this javascript may be packed into a single file so you’ll have to actually check whether a variable has been set before loading modules <i>dynamically</i> so you dont want static loading. And ANYWAY your tools may want to use shared css so you may as well namespace your CSS. And ANYWAY your default options may include event handlers or other things you can’t serialize easily into attributes of an element. And you may want to compose tools or find them with CSS so what’s wrong with using CSS classes instead of the element name for that? And ANYWAY you will want to render your tools in a readable way so why not stuff JSON into data attributes which were allowed for exactly such purposes? And ANYWAY you may want to use a powerful templating engine like Handlebars. The only part I am not sure of is the last one.<p>Seems to me - but I am biased - that we have the optimal approach. If something else comes out we can just turn Q.Tool.define into a wrapper around window.customComponents.define. But our users won’t have to change a thing. They can continue to use Q.Tool and Q.Page and Q.exports(arg, arg) and Q.requires(module, callback) without worrying what’s underneath. Isn’t it better and more stable?<p>But everyone got into Angular and React with its JSX etc. I think the main sell was the dirty checking (the model in Angular, the DOM in React). So you can just render a large chunk. I never saw the benefit of that. You <i>should</i> reason about mutations imho. Components are views with their own viewmodel, that’s all. You can update a bunch of state parameters and then call stateChanged(“a”, “b”) which would requestAnimationFrame() and update stuff. Is it so hard to call stateChanged() after changing state.a and state.b ? Do you really need to instead grok digest cycles or a virtual dom??
DonHopkins超过 5 年前
I&#x27;ve been going down the long road of learning Angular recently, and I love it and want to learn more, but I have a couple naive newbie questions whose answers I thought should be obvious, but I haven&#x27;t been able to figure out:<p>Is there a standard way to define local variables in an Angular template so you don&#x27;t have to repeat the same redundant expression again and again (or so you can at least give an expression a self documenting variable name so it&#x27;s not so mysterious)? Or do you have to define an instance variable on your component and figure out how to initialize it to the right value before the template gets executed, with no way to lazily (or repeatedly) evaluate it by putting the calculation inside conditionals (or loops) in the template so they&#x27;re not run if they&#x27;re not needed (or to calculate the local variables independently for every loop iteration)? Is there an angular hook or technique that&#x27;s meant for that, and efficient, and hopefully doesn&#x27;t involve much arbitrary non-JavaScript gobbledygook syntax, and is at least somewhat standard and well supported? Please don&#x27;t tell me I shouldn&#x27;t ever want to do that for some reason of ideological purity or separation of concerns (as if a templating language could ever be called &quot;pure&quot; or &quot;elegant&quot;). The common legitimate use case is ngIf=&quot;some expression is not null&quot; then {{some expression}}, and also ngIf=&quot;some expressions&quot; ... ngIf=&quot;not some expression&quot;.<p>I googled for it, and the solutions of &quot;abuse ngIf&#x27;s special goofy syntax to name the result of the condition and pray to God it&#x27;s truthy or don&#x27;t bother&quot; and &quot;abuse ngFor to loop over an array of one item to give it a name&quot; are not acceptable answers. There were also a few competing and possibly out-of-date &quot;install this non-standard ngLet directive that I hacked up but don&#x27;t support, but don&#x27;t call it with an &quot;ng&quot; prefix because that&#x27;s reserved for the Angular team&quot; -- but isn&#x27;t there a standard way of doing such a simple essential thing, that the Angular team already thought of and included, such that other people will have some clue what&#x27;s going on when they see it? And it would be nice to be able to define more than one variable at once per begin&#x2F;end tag, if you know what I mean. Maybe even without using any begin&#x2F;end tags, perchance to dream?<p>Also, is there a way to easily define simple light weight macros (&quot;snippet reuse&quot;) so you can repeat the same pattern in one or more components, without defining a whole component in all its glory and splendor with multiple files that other multiple files need to import and declare? Or even a global file of shared macros that a bunch of other templates can import, like the globally shared css declarations you can include in local css files? I&#x27;ve seen &quot;ng-template&quot;, but I am having a hard time getting my head around it, compared to the simplicity and power of Genshi&#x27;s py:match, that&#x27;s based on xpath, and py:def, that precisely follows Python function calling conventions and that you can easily call from any normal expression. And py:match is quite useful for defining concise custom tags (or xpath patterns) that can wrap embedded content. In comparison, ng-templates seems quite clumsy and limited, and confusing about calling and scoping and passing parameters and content, which is nothing like standard JavaScript calling conventions, and reminds me more of the abomination that is Zope METAL templates.<p><a href="https:&#x2F;&#x2F;zope.readthedocs.io&#x2F;en&#x2F;latest&#x2F;zopebook&#x2F;AppendixC.html#metal-overview" rel="nofollow">https:&#x2F;&#x2F;zope.readthedocs.io&#x2F;en&#x2F;latest&#x2F;zopebook&#x2F;AppendixC.htm...</a><p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Template_Attribute_Language#METAL" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Template_Attribute_Language#ME...</a><p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Zope#Zope_Page_Templates" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Zope#Zope_Page_Templates</a><p>I&#x27;ve been using and loving Genshi with Python for more than a decade (and before that, Kid, which Genshi is almost the same as, and before that Zope page templates, TAL, and METAL templates, which inspired Kid and Genshi, but totally sucked), and I love its ability to drop into Python with &lt;?python ... ?&gt; to define some variables or import some functions locally in the template that you can use, with real honest to god multi-line indented Python &quot;if&quot; statements for logic (and Python comments for, err, commenting) instead of Christmas trees of deeply nested ternary ? : operators (or rather postfix conditional &quot;foo if bar else baz&quot; Python expressions). Genshi also has &quot;with&quot; for defining scoped local variables with tags, like &lt;py:with vars=&quot;y=7; z=x+10&quot;&gt;$x $y $z&lt;&#x2F;py:with&gt;.<p>And I also love Genshi&#x27;s py:def for making locally defined or libraries of includable imperative &quot;code snippet&quot; templates you can call just like Python functions (with glorious optional named defaulting args, etc), and py:match for declaring xpath pattern matching templates that can wrap html content as a parameter (so the macro can cherry-pick out and transform different parts of the passed content with xpath), as well as taking attribute parameters.<p>Another nice feature of Genshi is that for all directives it supports both the attribute form like &lt;div py:if=&quot;condition&quot;&gt; ... &lt;&#x2F;div&gt; attached to an element that you want to keep, or the element form that dissolves without leaving an element, like &lt;py:if test=&quot;condition&quot;&gt; ... &lt;&#x2F;py:if&gt; . You can also attach multiple directive attributes to the same element, thanks to the way it executes them in a well defined ordered hierarchy that makes practical sense (like &quot;for&quot; above &quot;if&quot;, so each iteration of the &quot;for&quot; loop can be conditionalized with its own &quot;if&quot; evaluation), and &quot;def&quot; above all else, so you can define a single tag macro that loops over something then conditionalizes each iteration, then sets attributes on and adds content to the included elements. It&#x27;s quite concise and expressive!<p>&lt;div py:def=&quot;FizzBusted(count)&quot; py:for=&quot;i in range(count)&quot; py:if=&quot;i % 3&quot; py:attrs=&quot;{&#x27;class&#x27;: &#x27;orange&#x27; if i % 7 &amp;lt; 2 else &#x27;blue&#x27;}&quot; py:content=&quot;[&#x27;odd&#x27;, &#x27;even&#x27;][i%2]&quot;&#x2F;&gt;<p><a href="https:&#x2F;&#x2F;genshi.edgewall.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;genshi.edgewall.org&#x2F;</a><p><a href="https:&#x2F;&#x2F;genshi.edgewall.org&#x2F;wiki&#x2F;Documentation&#x2F;xml-templates.html" rel="nofollow">https:&#x2F;&#x2F;genshi.edgewall.org&#x2F;wiki&#x2F;Documentation&#x2F;xml-templates...</a><p>py:def<p><a href="https:&#x2F;&#x2F;genshi.edgewall.org&#x2F;wiki&#x2F;Documentation&#x2F;xml-templates.html#id4" rel="nofollow">https:&#x2F;&#x2F;genshi.edgewall.org&#x2F;wiki&#x2F;Documentation&#x2F;xml-templates...</a><p>py:match<p><a href="https:&#x2F;&#x2F;genshi.edgewall.org&#x2F;wiki&#x2F;Documentation&#x2F;xml-templates.html#id5" rel="nofollow">https:&#x2F;&#x2F;genshi.edgewall.org&#x2F;wiki&#x2F;Documentation&#x2F;xml-templates...</a><p>Processing order of multiple attributes (precedence rules you must remember, but they make practical sense, and at least Genshi is quite minimal and only has a few directives): py:def py:match py:when py:otherwise py:for py:if py:choose py:with py:replace py:content py:attrs py:strip<p><a href="https:&#x2F;&#x2F;genshi.edgewall.org&#x2F;wiki&#x2F;Documentation&#x2F;xml-templates.html#processing-order" rel="nofollow">https:&#x2F;&#x2F;genshi.edgewall.org&#x2F;wiki&#x2F;Documentation&#x2F;xml-templates...</a><p>These two features (local variables and code snippets) are so important to me, and I&#x27;m having such a hard time figuring out how to do them in Angular, that I feel like there&#x27;s whole a chapter in the Angular templating manual that I missed somehow. Thanks for any tips on how to do this kind of stuff with Angular templates!<p>I&#x27;ve written more opinions about Genshi and templating on hn before:<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=8445252" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=8445252</a><p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10842990" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10842990</a><p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12365442" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12365442</a><p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12527839" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12527839</a><p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=16677520" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=16677520</a><p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20745676" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20745676</a><p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10842902" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=10842902</a>
评论 #22264583 未加载
评论 #22264504 未加载
grkg8tr超过 5 年前
How does Aurelia compare?
评论 #22262820 未加载