This is more a technical question than a real problem so I don't know if it will be removed but I will ask it anyway.
So I am developing some platform using Symfony2
, AngularJS
, RequireJS
and other tons of stuff I need, everything works with harmony and peace, but I want to create some panels in pure HTML
(no twig files) so AngularJS
can load it using ngRoute
, but thoose files need to reside in /web/partials
(for example) to be loaded correctly, because assetic wont generate thoose files inside /bundles/foo/barbundle/partials/*.html
as they are not JS, CSS or Images...
The question is simple, is there any way to either force AngularJS
to load TWIG templates as partials or forcing Symfony2
assetic to dump my partials inside web folder?
I know that putting manually inside /web
is enough to load everything I need and it is loading perfectly in production, but I want to keep some folder structure and keep all my frontend stuff in the same folder /src/Foo/BarBundle/Resources/public/*
UPDATE
I just saw that assets are installing my html files inside my bundle public folder, I don't know why it didn't work before but creating them inside src/Foo/BarBundle/Resources/public/partials
and then app/console assets:install --symlinks
links them to /web/bundles/foobar/partials
, as I say, it didn't work before...
But the question about loading twig files with AngularJS still there.
So, you can easily load your partials from the web folder using app/console assets:install --symlink
to place partials and set the good asset path in your angular routing (like /web/bundles/foobar/partials/*.html
).
Load twig templates using Angular ngRouter is not a good thing, because PHP is an interpreted language. But load your partials in a Twig template using ngView is possible (PHP is interpreted, and after you switch markup with angular routes).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.