J
J
Johnny2016-05-21 16:00:48
Angular
Johnny, 2016-05-21 16:00:48

How to dynamically create pages (Image Gallery) in AngularJS?

Hello, tell me how can I assign a different url to each image in AngularJS. For example, I have the following directory structure:

/images
- /album_01
-- /photo_01.jpg
-- /photo_02.jpg
-- ...
- /album_02
-- /photo_01.jpg
-- /photo_02.jpg

~1000 images, it is necessary that each one has its own page, for example with the address: site.com/images/album_01/photo_01.html, where the actual image, title and description will be. If there are not many pages, then I did it with ngRoute, where I indicated the address and the controller, but what should I do in this case? (Started learning angular recently)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-05-21
@GreysonKind

If there are not many pages, then I did it with ngRoute

I suspect that you did not declare variables in the routing rules ...
In general, I recommend using uiRouter or angular-component-router instead of ngRoute. Well, your url template will be something like this:
ps Maybe you should remove this .html suffix? It's like... it's not needed.
pps Since you are starting to study angular, I recommend that you monitor the state of affairs with the documentation. At the moment, it is very outdated, and if you take Russian-language sources, even more so. All of them are guided by the approaches of angular 1.0-1.1, although there are already 1.5 with more concise options.
In particular, a completely rewritten guide for working with angular is about to be merged: https://github.com/angular/angular.js/pull/14416

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question