什么是AngularJS中的状态过滤?(What is stateful filtering in AngularJS?)
我正在阅读AngularJS开发者指南,并在“过滤器”部分( https://docs.angularjs.org/guide/filter#stateful-filters )中查看“状态过滤器”。
给出了以下描述:
非常不鼓励编写有状态的过滤器,因为它们的执行不能被Angular进行优化,这往往会导致性能问题。 只有将隐藏状态作为模型并将其转换为过滤器的参数,才能将许多状态过滤器转换为无状态过滤器。
我是Web开发的新手,所以不知道什么是状态过滤,Angular文档没有解释它:(有人可以解释一个正常的过滤器和状态过滤器之间的区别是什么?
I was reading the AngularJS developer guide on the Filter section (https://docs.angularjs.org/guide/filter#stateful-filters) and came across "Stateful Filters".
This description is given as follows:
It is strongly discouraged to write filters that are stateful, because the execution of those can't be optimized by Angular, which often leads to performance issues. Many stateful filters can be converted into stateless filters just by exposing the hidden state as a model and turning it into an argument for the filter.
I'm new to web development, so have no idea what Stateful filtering is, and Angular Documentation didn't explain it either :( Can someone please explain what is the difference between a normal filter and a stateful filter is?
原文:https://stackoverflow.com/questions/25877704
最满意答案
我怀疑你的apache配置没有设置为遵循符号链接。
您需要在Apache配置中启用
FollowSymLinks
选项。 如果主配置允许您覆盖此选项,也可以在.htaccess
文件中启用它。将
.htaccess
文件放在/var/www/html
,其中包含:
Options +FollowSymLinks
要实现这一点,您需要将正确的
Directory
的AllowOverride
指令设置为至少Options
(如果这是当前值,则All
也可以工作)I suspect your apache config is not set to follow symbolic links.
You need to enable the
FollowSymLinks
option in your Apache configuration. You can also enable that in a.htaccess
file, if the main configuration allows you to override this option.Place a
.htaccess
file in/var/www/html
, containing:
Options +FollowSymLinks
For that to work, you'll need the correct
Directory
'sAllowOverride
directive to be set to at leastOptions
(All
would work too, if that's the current value)
相关问答
更多-
我怀疑你的apache配置没有设置为遵循符号链接。 您需要在Apache配置中启用FollowSymLinks选项。 如果主配置允许您覆盖此选项,也可以在.htaccess文件中启用它。 将.htaccess文件放在/var/www/html ,其中包含: Options +FollowSymLinks 要实现这一点,您需要将正确的Directory的AllowOverride指令设置为至少Options (如果这是当前值,则All也可以工作) I suspect your apache config is ...
-
确保提供“jquery-1.6.4.js”的路径。 检查src / scripts。 如果它在那里你应该包括它有点像这样,“〜/ src / scripts / jquery-1.6.4.js”。 假设你有“src”文件夹,其中存在“script”文件夹,其中包含你的jquery文件。 Latest version of angular-cli(angular-cli: 1.0.0-beta.19-3) provides an assets folder under src directory. You j ...
-
经过深入研究后,我发现JBoss AS7实际上并不支持YET MyFaces。 其中一位JBoss开发人员回答了以下问题: 你好JBoss团队, 我想知道我是否可以使用MyFaces代替Mojarra作为jsf 实现。 对不起,如果这不是提出这个问题的地方。 谢谢 拉斐尔卡斯特罗 **对于AS7,我们目前无法让您使用MyFaces。 这是在待办事项清单上,但尚未安排发布。 斯坦** 这是该讨论的URL 使用MyFaces代替Mojarra和JBoss AS7 。 因此,您似乎必须使用以前版本的JBoss,例 ...
-
如果我运行节点脚本/ web-server.js或cd到脚本并运行节点web-server.js而不仅仅是./web-server.js,节点退出时出现错误,无法找到文件web-server.js if I run node script/web-server.js or cd into script and run node web-server.js instead of just ./web-server.js, node exits with an error that it cannot find ...
-
为了包含一个全局库,你必须在angular-cli.json scripts数组中添加jquery.js文件: "scripts": [ "../node_modules/jquery/dist/jquery.js" ] 之后,如果已经启动,请重新启动ng serve 。 In order to include a global library, you have to add the jquery.js file in the scripts array from angular-cli.json: ...
-
我认为静态html文件不能用作视图。 请求被转发到视图,即/MeraComputer/WEB-INF/views/index.html ,因为它是静态文件而不是请求处理程序,您可能会收到警告。 应以不同方式处理静态文件。 我认为这是一个类似的帖子,可能有所帮助。 I think static html files won't work as views. The request is being forwarded to the view, i.e. to /MeraComputer/WEB-INF/vie ...
-
在.net Core中,您需要确保使用静态文件中间件,请参阅静态文件文档以了解如何添加它 - 默认情况下应该在新的.net核心项目中使用。 没有这个中间件,就不会提供静态文件 - 例如。 * .css,*。js,* .html等! In .net Core you need to make sure you're using the static files middleware, please see static files documentation to see how to add this - ...
-
Angular2与webpack报告错误404 index.html未找到(Angular2 with webpack reports error 404 index.html not found)[2021-07-26]
由于您的项目已经拆分了您的webpack配置,因此需要将这些配置合并到webpack以了解您的所有参数。 最简单的方法是使用lodash中的_.merge方法,详见: https ://lodash.com/docs/4.16.4#merge 首先安装lodash依赖项: npm install --save-dev lodash 然后你合并你的配置,你的webpack.config.js应该是这样的: var path = require('path'); var webpack = require(' ... -
作为一个循环工作,我在RequestMapping注释中添加了Angular Routes,并将它们全部指向index.html : @RequestMapping({"/login", "/logout"}) public String index() { return "index.html"; } 编辑:作为一个更好的工作,您可以使控制器实现ErrorController ,覆盖getErrorPath方法,然后添加/error的映射,它将作为一个全能(或映射缺失)方法。 @Controller p ...
-
有2个地方可以找到问题: httpd.conf,.htaccess - 都是apache web服务器配置文件。 301重定向(如果您之前使用过任何重定向)。 如果你有,你将无法访问你的根URL,除非你清除浏览器URL路由缓存(例如,清除chrome上的浏览器数据没有帮助)。 怎么做 - 取决于您的浏览器。 要阅读有关该主题的更多信息,请访问http://getluky.net/2010/12/14/301-redirects-cannot-be-undon/ There are 2 places to l ...