最終行の意味は調査中。
php app/console cache:clear --env=prod --no-debug php app/console assets:install web_directory php app/console assetic:dump web_directory
最終行の意味は調査中。
php app/console cache:clear --env=prod --no-debug php app/console assets:install web_directory php app/console assetic:dump web_directory
Angularは標準でもカレンダーは出してくれるんだけどどうにもださいのでカスタマイズしてみる。
下記のdatepickerが追加ファイルも少なくてデザインもいい感じ。
https://github.com/g00fy-/angular-datepicker
まずはconfig()メソッドで$httpProviderサービスにinterceptorを追加する。
angular.module('hogeApp', []).config(['$httpProvider', function($httpProvider) {
$httpProvider.interceptors.push('errorHttpInterceptor');
}]);
次にpushしたerrorHttpInterceptorサービスを実装する。
angular.module('hogeApp', []).factory('errorHttpInterceptor', ['$q', '$location',
function($q, $location) {
return {
// optional method
request: function(config) {
return config;
},
// optional method
requestError: function(rejection) {
return $q.reject(rejection);
},
// optional method
response: function(response) {
return response;
},
// optional method
responseError: function(rejection) {
if(rejection.status !== 200) {
// レスポンスコードに異常が見られたら処理をかますなどすきに実装する。
return $q.reject(rejection);
}
return $q.reject(rejection);
}
};
}
]);
$path = '/path/to/file.ext'
$response = new Response();
$response->headers->set('Content-type', 'application/octect-stream');
$response->headers->set('Content-Disposition', sprintf('attachment; filename="%s";', 'fileName'));
$response->sendHeaders();
$response->setContent(readfile($path));
はビュー側のディレクティブng-controllerでコントローラーを指定してやる必要はない。
という事に今更気づく。
コントローラーの処理が毎回2度ずつ走っているので気になって調べたら思っきし同じことしてる質問をみつけてしまった。
http://stackoverflow.com/questions/15535336/combating-angularjs-executing-controller-twice
たしかに考えてみればそうだよね。
下記のサンプルが非常にリッチですばらしい。
http://angular-file-upload.appspot.com/
githubはこちら。
https://github.com/danialfarid/angular-file-upload