use \Bitrix\Main\Data\cache;
$cache = cache::createInstance();
if( $cache->initCache( $ttl, $id, $id ) ){
$res = $cache->getVars();
$arRes = $res["arRes"];
}else{
$res = array();
try{
$cache->startDataCache( $ttl, $id, $id );
$cache->endDataCache( array(
"arRes" => $arRes
) );
}catch( SystemException $e ){
$cache->abortDataCache();
ShowError( $e->getMessage() );
}
}
var cancel = $q.defer();
$http({..., timeout: cancel.promise});
cancel.resolve(); // Отменит выполнение запроса
<div ng-repeat="item in level1" ng-init="level1Index = $index">
<div ng-repeat="item in level2" ng-init="level2Index = $index">
{{level1Index}} - {{level2Index}}
</div>
</div>