I started using angular1 recently and there is a task to organize routing.
Roughly speaking, for an online store, type:
/catalog/idCategory/idProducts (/catalog/mobile/meizu, /catalog/tv/sony) Transition can be in all 3 ways. For example, in the catalog we have all the products. In categories, respectively, the goods by category and further already the product itself.
Having read the information, I still tend to ui.route , but I just can’t implement this hierarchy. As I understand it, each page has its own controller.
Ie routing should be like:
.state('tasks', { url: "/catalog", templateUrl: "templates/catalog.html", controller: "catalogCtrl" }) .state('catalog.category', { url: "/catalog/:catalogId", templateUrl: "templates/catalogCateg.html", controller: "catalogCategCtrl" }) .state('catalog.category.details', { url: "/catalog/:catalogId/:idproduct", templateUrl: "templates/productPage.html", controller: "productPageCtrl" }) And in controllers, we have to define $stateParams and pass to the url .
Maybe someone has experience of this implementation or interesting examples, links. It would be a perfect ready-made example. I can disassemble. I read the documentation on ui.route .
He did a lot of things from there, but it still doesn’t work out.