После многих испытаний я нашел решение. На самом деле это обсуждалось на Angular Github на https://github.com/angular/angular/issues/27991
1. Создайте свой проект с помощью команды, подобной ng build --prod --base-href /toys/
. Если вы хотите загрузить сайт как www.mysite.com/toys
.
2. Выше будет сгенерировано project-home/dist/toys
. Создайте файл .htaccess
в этой папке со следующим содержанием
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) index.html [NC,L]
3. Скопируйте источники в project-home/dist/toys
в папку домена вашего сайта. На виртуальном хостинге это обычно будет похоже на /public_html/yoursitename/
.
В моем примере у меня был такой файл /public_html/ngstrorefront/toys/.htaccess
. Обратите внимание, что .htaccess
должен находиться в папке на уровне ваших проектов Angular 'index.html
, а не в корне вашего сайта.
Ваш сайт также должен работать с маршрутами.
Примечание:
.htaccess
лучше использовать этот. .htaccess
только для чтения. Я видел несколько сайтов, атакованных с помощью этого файла. Romain's answer covers (almost :) perfectly the current solutions. As for the future support, Anders Hejlsberg has previously stated that they'were in wait & see mode about AOP.
We can only hope that with the managed rewrite of csc, and a «Compiler as a Service», one could plug into the compiler, and inject aspects there.
Spring.NET также предоставляет АОП. Требуется много настроек, но после настройки все работает нормально.
I haven't heard of a "clean built-in way of doing AOP". But as you stated, there are already plenty "clean ways of doing AOP", using mature and powerful frameworks like PostSharp or Castle DynamicProxy.
Using the BCL, one obvious way to do AOP, with pretty strong limitations thought, is to use transparent and real proxys, from .NET Remoting stack.
Another way is to rely on System.Reflection.Emit to dynamically generate proxies, like, hum, DynamicProxy from Castle.
Finally, there is also another official Microsoft flagged solution, that came with the Enterprise Library. I'm talking about the Policy Injection Application Block. Unity also offers some interception capabilities that leverage PIAB.
Майский выпуск Delphi Prism имеет поддержку АОП на уровне языка.
Вы можете узнать больше об этом здесь
http://prismwiki.codegear.com/en/ Cirrus
Здесь также есть библиотека аспектов с открытым исходным кодом