{"id":268389,"date":"2015-11-17T18:22:03","date_gmt":"2015-11-17T15:22:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=268389"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=268389","title":{"rendered":"Ionic Framework \u2014 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043a\u0430\u043c\u0435\u0440\u043e\u0439"},"content":{"rendered":"<p>       <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/16c\/14e\/530\/16c14e530af9913b0feb642fe8698b70.png\" alt=\"image\"\/><br \/>  \u041f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u043e\u043f\u0440\u043e\u0441\u0430 \u0438\u0437 <a href=\"http:\/\/habrahabr.ru\/post\/255653\/\">\u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0442\u043e\u043f\u0438\u043a\u0430<\/a> \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u0441\u0435\u0440\u0438\u044e \u0441\u0442\u0430\u0442\u0435\u0439 \u043e\u0431 <i>Ionic Framework<\/i> (\u0434\u0430\u043b\u0435\u0435 IF). \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043a\u0430\u043c\u0435\u0440\u043e\u0439 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 localStorage. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u044b \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0442\u043e\u043f\u0438\u043a\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0443\u0436\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<ul>\n<li><a href=\"#ngcordova\">\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 ngCordova<\/a><\/li>\n<li><a href=\"#pluginadd\">\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u0430\u043c\u0435\u0440\u043e\u0439<\/a><\/li>\n<li><a href=\"#service\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u0430\u043c\u0435\u0440\u043e\u0439<\/a><\/li>\n<li><a href=\"#templates\">\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432<\/a><\/li>\n<li><a href=\"#totaladding\">\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0438 \u0444\u0430\u0431\u0440\u0438\u043a<\/a><\/li>\n<li><a href=\"#summary\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/a><\/li>\n<\/ul>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h3><a name=\"ngcordova\"><\/a>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 ngCordova<\/h3>\n<p>  \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c ngCordova. \u0421\u0442\u0430\u0432\u0438\u0442\u0441\u044f \u043e\u043d \u043f\u0440\u043e\u0441\u0442\u043e (\u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u043d\u0430\u0448\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u0432\u0435\u0434\u044c \u043f\u0440\u043e\u0448\u043b\u043e \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438&#8230;):<\/p>\n<pre><code class=\"bash\">sudo npm i -g cordova ionic bower bower install ngCordova <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 ngCordova \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 <i>index.html<\/i>:<\/p>\n<pre><code class=\"html\">&lt;script src=&quot;lib\/ngCordova\/dist\/ng-cordova.min.js&quot;&gt;&lt;\/script&gt; <\/code><\/pre>\n<p>  \u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (app.js):<\/p>\n<pre><code class=\"javascript\">angular.module('starter', ['ionic', 'ngCordova', 'starter.controllers', 'starter.services']) <\/code><\/pre>\n<p>  \u0438\u043d\u0430\u0447\u0435 \u043f\u0430\u0440\u043e\u0432\u043e\u0437\u0438\u043a \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u2026 \u0416\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0449\u0435 \u043f\u0430\u0440\u0443 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0424\u0421 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430:<\/p>\n<pre><code class=\"bash\">ionic plugin add cordova-plugin-file ionic plugin add cordova-plugin-file-transfer <\/code><\/pre>\n<p>  \u041f\u043e \u0438\u0434\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e file-transfer, \u0442.\u043a. \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0441\u043e\u0431\u043e\u0439 \u043e\u043d \u0442\u0430\u043a\u0436\u0435 \u0442\u044f\u043d\u0435\u0442 \u0438 file, \u043d\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0447\u0440\u0435\u0432\u0430\u0442 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u0445 \u0431\u0430\u0433\u043e\u0432\u2026<\/p>\n<h3><a name=\"pluginadd\"><\/a>\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u0430\u043c\u0435\u0440\u043e\u0439<\/h3>\n<p>  \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b IF \u0441\u043c\u043e\u0433 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u0430\u043c\u0435\u0440\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 <i>Cordova<\/i> <a href=\"https:\/\/www.npmjs.com\/package\/cordova-plugin-camera\">\u043f\u043b\u0430\u0433\u0438\u043d \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0449\u0438\u0439 \u044d\u0442\u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b<\/a>:<\/p>\n<pre><code class=\"bash\">ionic plugin add cordova-plugin-camera <\/code><\/pre>\n<p>  \u041f\u043b\u0430\u0433\u0438\u043d \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434:<\/p>\n<pre><code class=\"javascript\">navigator.camera.getPicture(SuccessCallback, ErrorCallback, Options); <\/code><\/pre>\n<p>  \u0413\u0434\u0435 SuccessCallback \u0438 ErrorCallback \u044d\u0442\u043e \u043d\u0430\u0448\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043c\u044b \u0432\u043e\u043b\u044c\u043d\u044b \u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0441\u0435 \u0447\u0442\u043e \u0432\u0437\u0434\u0443\u043c\u0430\u0435\u0442\u0441\u044f, \u0430 \u0432\u043e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 Options \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435 \u0434\u043b\u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u043a\u0430\u043c\u0435\u0440\u044b<\/b><\/p>\n<div class=\"spoiler_text\">\n<ul>\n<li>quality (Number): \u041a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0432 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u0435 \u043e\u0442 0 \u0434\u043e 100, \u0433\u0434\u0435 100 \u2014 \u0440\u0435\u0436\u0438\u043c \u0431\u0435\u0437 \u0441\u0436\u0430\u0442\u0438\u044f. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 50.<\/li>\n<li>destinationType(Number): \u0424\u043e\u0440\u043c\u0430\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e FILEURI. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0438\u043f\u0430\u043c\u0438 navigator.camera.DestinationType: <br \/> \n<pre><code class=\"javascript\">Camera.DestinationType = {       DATA_URL : 0,      \/\/ \u0421\u0442\u0440\u043e\u043a\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 base64       FILE_URI : 1,      \/\/ URI \u0444\u0430\u0439\u043b\u0430       NATIVE_URI : 2     \/\/ URI \u043f\u0443\u0442\u0438 \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0438\u0439 \u043e\u0442 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b (assets-library:\/\/ \u0434\u043b\u044f iOS \u0438 content:\/\/ \u0434\u043b\u044f Android) }; <\/code><\/pre>\n<\/li>\n<li>sourceType (Number): \u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e CAMERA. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0438\u043f\u0430\u043c\u0438 navigator.camera.PictureSourceType:<br \/> \n<pre><code class=\"javascript\">Camera.PictureSourceType = {       PHOTOLIBRARY : 0,       CAMERA : 1,       SAVEDPHOTOALBUM : 2 }; <\/code><\/pre>\n<\/li>\n<li>allowEdit (Boolean): \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0440\u0435\u0436\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e.<\/li>\n<li>encodingType (Number): \u0424\u043e\u0440\u043c\u0430\u0442 \u0444\u0430\u0439\u043b\u0430. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u00ab\u0443 \u0432\u0430\u0441 JPEG\u00bb. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0438\u043f\u0430\u043c\u0438 navigator.camera.EncodingType:<br \/> \n<pre><code class=\"javascript\">Camera.EncodingType = {       JPEG : 0,               \/\/ JPEG       PNG : 1                 \/\/ PNG }; <\/code><\/pre>\n<\/li>\n<li>targetWidth (Number): \u0428\u0438\u0440\u0438\u043d\u0430. \u0411\u0435\u0437 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432. \u0414\u043b\u044f \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 targetHeight \u0441 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u043c.<\/li>\n<li>targetHeight (Number): \u0412\u044b\u0441\u043e\u0442\u0430.<\/li>\n<li>mediaType (Number): \u0422\u0438\u043f \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0434\u0438\u0430 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e PICTURE. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0438 PictureSourceType \u0440\u0430\u0432\u043d\u044b\u043c PHOTOLIBRARY \u0438\u043b\u0438 SAVEDPHOTOALBUM. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0438\u043f\u0430\u043c\u0438 nagivator.camera.MediaType:<br \/> \n<pre><code class=\"javascript\">Camera.MediaType = {       PICTURE: 0,    \/\/ \u0422\u043e\u043b\u044c\u043a\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.       VIDEO: 1,      \/\/ \u0422\u043e\u043b\u044c\u043a\u043e \u0432\u0438\u0434\u0435\u043e (\u0412\u0421\u0415\u0413\u0414\u0410 \u0412\u041e\u0417\u0412\u0420\u0410\u0429\u0410\u0415\u0422 FILE_URI)       ALLMEDIA : 2   \/\/ \u0412\u0441\u0435 \u0442\u0438\u043f\u044b }; <\/code><\/pre>\n<\/li>\n<li>correctOrientation (Boolean): \u041f\u043e\u0432\u043e\u0440\u043e\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0435\u043d\u0441\u0430\u0446\u0438\u0438 \u043e\u0440\u0438\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u044a\u0435\u043c\u043a\u0438.<\/li>\n<li>saveToPhotoAlbum (Boolean): \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432 \u0430\u043b\u044c\u0431\u043e\u043c \u043f\u043e\u0441\u043b\u0435 \u0441\u044a\u0435\u043c\u043a\u0438.<\/li>\n<li>popoverOptions: iOS-only \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0449\u0438\u0439 \u043c\u0435\u0441\u0442\u043e\u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 popover \u043d\u0430 iPad. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0432 CameraPopoverOptions.<\/li>\n<li>cameraDirection (Number): \u041a\u0430\u043c\u0435\u0440\u0430 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f (\u0444\u0440\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u0430\u044f \u0438\u043b\u0438 \u0437\u0430\u0434\u043d\u044f\u044f). \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e BACK. \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0442\u0438\u043f\u0430\u043c\u0438 navigator.camera.Direction:<br \/> \n<pre><code class=\"javascript\">Camera.Direction = {       BACK : 0,      \/\/ Use the back-facing camera       FRONT : 1      \/\/ Use the front-facing camera }; <\/code><\/pre>\n<\/li>\n<\/ul>\n<p>  \u0412\u043e\u0442 \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u0438 \u0432\u0441\u0435 \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c\u2026  <\/div>\n<\/div>\n<h3><a name=\"service\"><\/a>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u0430\u043c\u0435\u0440\u043e\u0439<\/h3>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043b\u0443\u0436\u0431\u0443 \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043a\u0430\u043c\u0435\u0440\u043e\u0439 \u0431\u044b\u043b\u0430 \u043a\u043e\u043c\u0444\u043e\u0440\u0442\u043d\u043e\u0439. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c <i>promise<\/i> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043a\u0430\u043c\u0435\u0440\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u0448\u0438\u0445 callback&#8217;\u043e\u0432. \u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <i>services.js<\/i> (\u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u0442\u043e\u043f\u0438\u043a\u0435 \u043c\u044b \u0443\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0442\u0430\u043c \u0444\u0430\u0431\u0440\u0438\u043a\u0443 \u0433\u043e\u0440\u043e\u0434\u043e\u0432) \u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0438\u0442\u0435 \u0435\u0433\u043e \u043a \u0442\u0430\u043a\u043e\u043c\u0443 \u0432\u0438\u0434\u0443:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">services.js<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">angular.module('starter.services', []) .factory('Cities', function() {     \/\/ ... }).factory('Cam', function($q) {   return {     getPic: function(opt) {       var q = $q.defer();       navigator.camera.getPicture(function(res) {         q.resolve(res);       }, function(err) {         q.reject(err);       }, opt);       return q.promise;     }   }; }); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0418\u0442\u0430\u043a, \u0432 \u044d\u0442\u043e\u0439 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u043c\u044b, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f Angular&#8217;\u043e\u0432\u0441\u043a\u0438\u0439 <i><a href=\"https:\/\/docs.angularjs.org\/api\/ng\/service\/$q\">$q.defer<\/a>()<\/i>, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c <i>promise<\/i>, \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0434\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0441 \u043a\u0430\u043c\u0435\u0440\u044b (SuccessCallback, ErrorCallback) \u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 (Options). \u041d\u0435 \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0439\u0442\u0435 \u0444\u0430\u0439\u043b, \u043c\u044b \u043a \u043d\u0435\u043c\u0443 \u0435\u0449\u0435 \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f!<\/p>\n<h3><a name=\"templates\"><\/a>\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432<\/h3>\n<p>  \u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <i>tabs.html<\/i> \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d <i>tab<\/i>. \u0423 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0442\u0430\u043a\u043e\u0439:<\/p>\n<pre><code class=\"html\">  &lt;ion-tab title=&quot;Options&quot; icon-off=&quot;ion-gear-a&quot; icon-on=&quot;ion-gear-a&quot; href=&quot;#\/tab\/opt&quot;&gt;     &lt;ion-nav-view name=&quot;tab-opt&quot;&gt;&lt;\/ion-nav-view&gt;   &lt;\/ion-tab&gt; <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u043f\u0430\u043f\u043a\u0435 \u0441 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u043c\u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0448\u0430\u0431\u043b\u043e\u043d (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <i>tab-opt.html<\/i>) \u0438 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0444\u043e\u0440\u043c\u0443 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u0443\u044e:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">tab-opt.html<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"html\">&lt;ion-view view-title=&quot;\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438&quot;&gt; \t&lt;ion-content class=&quot;padding&quot;&gt; \t\t&lt;div class=&quot;list-item&quot;&gt; \t\t\t&lt;img class=&quot;full-image&quot; ng-src=&quot;{{user.ava || '.\/img\/ionic.png'}}&quot;&gt; \t\t\t&lt;label class=&quot;item item-input&quot;&gt; \t\t\t\t&lt;i class=&quot;icon ion-person placeholder-icon&quot;&gt;&lt;\/i&gt; \t\t\t\t&lt;input type=&quot;text&quot; placeholder=&quot;\u0418\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f&quot; ng-model=&quot;user.name&quot; ng-keyup=&quot;setUser();&quot; \/&gt; \t\t\t&lt;\/label&gt; \t\t\t&lt;label class=&quot;item item-input item-select&quot;&gt; \t\t\t\t&lt;div class=&quot;input-label&quot;&gt; \t\t\t\t\t\u0413\u043e\u0440\u043e\u0434 \t\t\t\t&lt;\/div&gt; \t\t\t\t&lt;select ng-model=&quot;user.city&quot; ng-change=&quot;setUser();&quot;&gt; \t\t\t\t\t&lt;option ng-repeat=&quot;city in cities&quot; ng-value=&quot;city.id&quot;&gt;{{city.name}}&lt;\/option&gt; \t\t\t\t&lt;\/select&gt; \t\t\t&lt;\/label&gt; \t\t\t&lt;button class=&quot;button button-full button-positive&quot; ng-click=&quot;getPic(1);&quot;&gt; \t\t\t\t\u0421 \u043a\u0430\u043c\u0435\u0440\u044b \t\t\t&lt;\/button&gt; \t\t\t&lt;button class=&quot;button button-full button-calm&quot; ng-click=&quot;getPic(0);&quot;&gt; \t\t\t\t\u0418\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \t\t\t&lt;\/button&gt; \t\t&lt;\/div&gt; \t&lt;\/ion-content&gt; &lt;\/ion-view&gt; <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u043a \u043f\u043e\u043b\u044f\u043c \u043c\u044b \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043b\u0438 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044f html, \u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u043f\u043e\u043b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u0422\u0430\u043a \u0436\u0435 \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043a\u043e\u0433\u0434\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0430 \u043e\u0442\u043f\u0443\u0449\u0435\u043d\u0430 (\u043a\u0441\u0442\u0430\u0442\u0438, \u0442\u0443\u0442 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c debounce) \u0438 \u043d\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0432\u044b\u0431\u043e\u0440\u0430 \u0433\u043e\u0440\u043e\u0434\u0430, \u0431\u044b\u043b\u0430 \u0441\u0434\u0435\u043b\u0430\u043d\u0430 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 setUser, \u044d\u0442\u043e \u0432\u0441\u0435 \u043c\u044b \u043e\u043f\u0438\u0448\u0435\u043c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0448\u0430\u0433\u0435. \u041d\u0435 \u0442\u0435\u0440\u043f\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c? \u041d\u043e \u043c\u044b \u0435\u0449\u0435 \u043d\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044e, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 localStorage, \u0442\u0430\u043a \u0447\u0442\u043e \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0435\u0449\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c\u2026<\/p>\n<h3><a name=\"totaladding\"><\/a>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0438 \u0444\u0430\u0431\u0440\u0438\u043a<\/h3>\n<p>  \u0417\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u043c\u0438. \u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 <i>app.js<\/i> \u0438 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0430\u0446\u0438\u044e \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0442\u0430\u0431\u0430:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">.state('tab.opt', {       url: '\/opt',     views: {       'tab-opt': {         templateUrl: 'templates\/tab-opt.html',         controller: 'OptCtrl'       }     } }) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u0432 <i>controllers.js<\/i> \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0443\u0436\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">OptCtrl<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">.controller('OptCtrl', function($scope, $ionicPopup, Cities, Cam, LS) { \t$scope.cities = Cities.all(); \t$scope.user = LS.getIt('user') || {}; \t$scope.showAlert = function(title, text) { \t\t$ionicPopup.alert({ \t\t\ttitle: title, \t\t\ttemplate: text \t\t}); \t}; \t$scope.setUser = function() { \t\tLS.setIt('user', $scope.user); \t}; \t$scope.getPic = function(source) { \t\tvar opt = { \t\t\tsourceType: source \t\t}; \t\tCam.getPic(opt).then(function(res) { \t\t\t$scope.user.ava = res; \t\t\t$scope.setUser(); \t\t}, function(err) { \t\t\t$scope.showAlert(&quot;\u041e\u0448\u0438\u0431\u043a\u0430&quot;, err); \t\t}); \t} }) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041e\u043f\u043f\u0430, \u0447\u0442\u043e \u0437\u0430 LS \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430!? \u041d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0431\u043e\u0439\u0442\u0435\u0441\u044c, \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043c\u0435\u0442\u043e\u0434 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 <i>localStorage<\/i>, \u0438 \u043d\u0430\u0441\u0442\u0430\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c (<i>services.js<\/i>):<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">LS<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">.factory('LS', function() {   return {     getIt: function(item) {       var it = false;       try {         it = JSON.parse(localStorage.getItem(item));         return it;       } catch(e) {         console.err(e);         return it;       }     },     setIt: function(item, obj) {       try {         localStorage.setItem(item, JSON.stringify(obj));         return true;       } catch(e) {         console.err(e);         return false;       }     }   }; }) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0418 \u043d\u0430\u0434\u043e \u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u0433\u043e\u0440\u043e\u0434\u043e\u0432, \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0441\u0432\u043e\u0439:<\/p>\n<pre><code class=\"javascript\">{     id: 555312,     name: '\u0418\u0432\u0430\u043d\u043e\u0432\u043e',     desc: '\u0413\u043e\u0440\u043e\u0434 \u043d\u0435\u0432\u0435\u0441\u0442',     emblem: 'https:\/\/upload.wikimedia.org\/wikipedia\/commons\/8\/8f\/Coat_of_Arms_of_Ivanovo_oblast.png' } <\/code><\/pre>\n<p>  \u0412\u044b \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0434\u0443\u043c\u0430\u0435\u0442\u0435 \u00ab\u043a \u0447\u0435\u043c\u0443 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043b\u043e\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0439?\u00bb. \u0410 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0441\u0435\u0431\u0435, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b \u0433\u043e\u0440\u043e\u0434 (\u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0432 \u0432 localStorage) \u0438 \u043f\u0440\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u043a\u0438\u0434\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u043e\u0433\u043e\u0434\u0443 \u0432 \u0440\u043e\u0434\u043d\u043e\u043c \u0433\u043e\u0440\u043e\u0434\u0435, \u043a\u0440\u0443\u0442\u043e \u0436\u0435! \u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0448\u0442\u0440\u0438\u0445, \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u0434\u0432\u0430 \u043d\u0430\u0448\u0438\u0445 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">CityCtrl, CityDetailCtrl<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">.controller('CityCtrl', function($scope, Cities, LS) { \t$scope.cities = Cities.all(); \t$scope.user = LS.getIt('user') || {}; \tif ($scope.user.city) { window.location.href = '#\/tab\/city\/'+$scope.user.city; } }) .controller('CityDetailCtrl', function($scope, $http, $stateParams, $ionicPopup, $ionicLoading) { \t$scope.data = {}; \t$scope.id = $stateParams.id; \t$scope.showAlert = function(title, text) { \t\t$ionicPopup.alert({ \t\t\ttitle: title, \t\t\ttemplate: text \t\t}); \t}; \t$scope.refresh = function() { \t\t$ionicLoading.show(); \t\t$http.get('http:\/\/api.openweathermap.org\/data\/2.5\/forecast\/daily?id='+$scope.id+'&appid=2de143494c0b295cca9337e1e96b00e0') \t\t.success(function(data, status, headers, config) { \t\t\t$scope.data = data; \t\t\t$ionicLoading.hide(); \t\t\t$scope.$broadcast('scroll.refreshComplete'); \t\t}) \t\t.error(function(data, status, headers, config) { \t\t\t$ionicLoading.hide(); \t\t\t$scope.showAlert(status, data); \t\t\t$scope.$broadcast('scroll.refreshComplete'); \t\t}); \t}; \t$scope.refresh(); }) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041c\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u043f\u0435\u0440\u0435\u043a\u0438\u0434\u044b\u0432\u0430\u043b\u043e \u043d\u0430 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0433\u043e\u0440\u043e\u0434, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043b\u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <i><a href=\"http:\/\/ionicframework.com\/docs\/api\/service\/$ionicLoading\/\">$ionicLoading<\/a><\/i> \u0434\u043b\u044f \u043f\u043e\u043a\u0430\u0437\u0430 \u043e\u043a\u043d\u0430 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041d\u0430\u0434\u0435\u044e\u0441\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u043b, \u0432\u0441\u0435 \u0433\u043e\u0442\u043e\u0432\u043e, \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c (ionic serve &#8212;lab, \u0435\u0441\u043b\u0438 \u0437\u0430\u0431\u044b\u043b\u0438):<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">It works!<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"\/\/habrastorage.org\/files\/ed6\/7ca\/604\/ed67ca6049ce4b5b9eead72b82ec9fd4.png\"\/>  <\/div>\n<\/div>\n<h3><a name=\"summary\"><\/a>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e IF \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0432\u0441\u0451 \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0438 \u043f\u0440\u043e\u0449\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0441\u043c\u0435\u043b\u043e \u043c\u043e\u0433\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0442\u043e \u044d\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u043b\u0443\u0447\u0448\u0438\u0445 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 \u0434\u043b\u044f \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0438 \u0434\u0430\u0436\u0435 \u0434\u043b\u044f production \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0414\u0435\u0440\u0437\u0430\u0439\u0442\u0435! \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0447\u0443 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0447\u0430\u0442\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e socket.io \u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0435\u0449\u0451 \u043a\u043e\u0435-\u0447\u0435\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c ;). \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438, \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u2014 \u043c\u0438\u043b\u043e\u0441\u0442\u0438 \u043f\u0440\u043e\u0448\u0443 \u0432 \u041b\u0421!               <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/256387\/\"> http:\/\/habrahabr.ru\/post\/256387\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/16c\/14e\/530\/16c14e530af9913b0feb642fe8698b70.png\" alt=\"image\"\/><br \/>  \u041f\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430\u043c \u043e\u043f\u0440\u043e\u0441\u0430 \u0438\u0437 <a href=\"http:\/\/habrahabr.ru\/post\/255653\/\">\u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0442\u043e\u043f\u0438\u043a\u0430<\/a> \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u044e \u0441\u0435\u0440\u0438\u044e \u0441\u0442\u0430\u0442\u0435\u0439 \u043e\u0431 <i>Ionic Framework<\/i> (\u0434\u0430\u043b\u0435\u0435 IF). \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043a\u0430\u043c\u0435\u0440\u043e\u0439 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 localStorage. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0441\u043d\u043e\u0432\u044b \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u0437 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0442\u043e\u043f\u0438\u043a\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u0443\u0436\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<ul>\n<li><a href=\"#ngcordova\">\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 ngCordova<\/a><\/li>\n<li><a href=\"#pluginadd\">\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u0430\u043c\u0435\u0440\u043e\u0439<\/a><\/li>\n<li><a href=\"#service\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u0430\u043c\u0435\u0440\u043e\u0439<\/a><\/li>\n<li><a href=\"#templates\">\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432<\/a><\/li>\n<li><a href=\"#totaladding\">\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0438 \u0444\u0430\u0431\u0440\u0438\u043a<\/a><\/li>\n<li><a href=\"#summary\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/a><\/li>\n<\/ul>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-268389","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/268389","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=268389"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/268389\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=268389"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=268389"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=268389"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}