V
V
VoKforever2020-08-28 19:47:56
Angular
VoKforever, 2020-08-28 19:47:56

How to get from html -> angularJS $templateCache.put?

Hello! I'm building a website, I need to put it on a script.
How can I make normal html look like this:

$templateCache.put('parametric','<div class="content-wrapper" style="background-image: url(\'images/picker/parametric-bg.jpg\')">\n\n<div class="parametric-container">\n\n<div class="table-container">\n\n    <div class="filters">\n        <div class="row">\n            <div class="title">Количество комнат</div>\n            <div class="body">\n                <button class="rooms-filter-button"\n                        ng-click="vm.filter.rooms = 1"\n                        ng-class="{active: vm.filter.rooms === 1}">1</button>\n                <button class="rooms-filter-button"\n                        ng-click="vm.filter.rooms = 2"\n                        ng-class="{active: vm.filter.rooms === 2}">2</button>\n                <button class="rooms-filter-button"\n                        ng-click="vm.filter.rooms = 3"\n                        ng-class="{active: vm.filter.rooms === 3}">3</button>\n            </div>\n        </div>\n        <div class="row">\n            <div class="title">Этаж</div>\n            <div class="body">\n                <div range-slider ng-model="vm.filter.floor" step="1" required></div>\n            </div>\n        </div>\n        <div class="row">\n            <div class="title">Площадь, м<sup>2</sup></div>\n            <div class="body">\n                <div range-slider ng-model="vm.filter.area" step="2" required></div>\n            </div>\n        </div>\n        <div class="row">\n            <div class="title">Стоимость млн. руб.</div>\n            <div class="body">\n                <div range-slider ng-model="vm.filter.price" step="0.5" required></div>\n            </div>\n        </div>\n    </div>\n\n    <div class="apt-table short-table">\n        <ul class="apt-table-head">\n            <li class="apt-table-cell" ng-click="vm.sortBy(\'corpusName\')">Корпус</li>\n            <li class="apt-table-cell" ng-click="vm.sortBy(\'floor\')">Этаж\n                <i class="sorter" ng-class="vm.sorterClass(\'floor\')"></i>\n            </li>\n            <li class="apt-table-cell" ng-click="vm.sortBy(\'flat\')">№\n                <i class="sorter" ng-class="vm.sorterClass(\'flat\')"></i>\n            </li>\n            <li class="apt-table-cell" ng-click="vm.sortBy(\'rooms\')">Комнат\n                <i class="sorter" ng-class="vm.sorterClass(\'rooms\')"></i>\n            </li>\n            <li class="apt-table-cell" ng-click="vm.sortBy(\'area\')">Площадь, м2\n                <i class="sorter" ng-class="vm.sorterClass(\'area\')"></i>\n            </li>\n            <li class="apt-table-cell" ng-click="vm.sortBy(\'price\')">Цена, руб.\n                <i class="sorter" ng-class="vm.sorterClass(\'price\')"></i>\n            </li>\n            <li class="apt-table-cell"><i class="heart-icon heart-icon-white"></i></li>\n        </ul>\n        <div class="apt-table-content" scrollbar>\n            <ul class="apt-table-row" ng-repeat="flat in vm.currentFlats track by $index"\n                ng-mouseover="vm.showPopup()"\n                ng-mousemove="vm.over($event, flat)"\n                ng-mouseleave="vm.popupVisible = false"\n                    >\n                <li class="apt-table-cell" ui-sref="flat({id: flat.id, from: \'parametric\'})">{{flat.corpusName}}</li>\n                <li class="apt-table-cell" ui-sref="flat({id: flat.id, from: \'parametric\'})">{{flat.floor}}</li>\n                <li class="apt-table-cell" ui-sref="flat({id: flat.id, from: \'parametric\'})">{{flat.flat}}</li>\n                <li class="apt-table-cell" ui-sref="flat({id: flat.id, from: \'parametric\'})">{{flat.rooms}}</li>\n                <li class="apt-table-cell" ui-sref="flat({id: flat.id, from: \'parametric\'})">{{flat.area}}</li>\n                <li class="apt-table-cell" ui-sref="flat({id: flat.id, from: \'parametric\'})">{{vm.format(flat.price)}}</li>\n                <li class="apt-table-cell" ng-click="vm.fave(flat.id)">\n                    <i class="heart-icon"\n                       ng-class="{\'heart-icon-green\': !vm.isFaved(flat.id), \'heart-icon-green-full\': vm.isFaved(flat.id)}"></i>\n                </li>\n            </ul>\n\n        </div>\n\n    </div>\n\n    <div class="miniplan" ng-class="{hidden: !vm.popupVisible}" ng-style="vm.popupY"></div>\n\n</div>\n\n</div>\n\n</div>\n\n<div class="crumbs-container">\n    <a href="/" class="crumbs-element">Главная</a><!--\n    --><a href="choose/#/parametric" class="crumbs-element">Подбор по параметрам</a>\n</div>\n\n<div class="infrastructure-submenu picker-mode">\n    <a href="choose/#/">Визуальный подбор</a><a href="choose/#/parametric" class="active">Подбор по параметрам</a>\n</div>');

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question