FLYNNLABAboutMeCodingActivityStudy 2024초등수학링크오프너릴리즈노트WordTest
angularjs에서 item-service protocol 출력하기
2014-09-22
angularjs, item-service

이슈

ng-href에서 item-service 프로토콜을 unsafe라는 prefix가 추가가 되어서 해결책을 찾아보았다.

<a href="unsafe:item-service:...">...</a>

해결 방법

angularjs(1.2.7)의 기본 허용 프로토콜

/**
 * @description
 * Private service to sanitize uris for links and images. Used by $compile and $sanitize.
 */
function $$SanitizeUriProvider() {
  var aHrefSanitizationWhitelist = /^\s*(https?|ftp|mailto|tel|file):/,
    imgSrcSanitizationWhitelist = /^\s*(https?|ftp|file):|data:image\//;
...

허용 프로토콜 추가 방법

  app.config(['$compileProvider', function($compileProvider){
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|file|itms-services):/);
...

참조

http://stackoverflow.com/questions/15606751/angular-changes-urls-to-unsafe-in-extension-page