angularjs - Steam:// link not "unsafe" -


i'm trying steam's add friends' link work reason sanitation isn't working. i'm new angular (first app) , may missing huge/obvious. code added config , html. i'm using angular 1.1.5. link steam below displays "unsafe" , not function. sanitation doesn't seem working intended.

thanks in advance!

@app.config(['$routeprovider', ($routeprovider) ->    $routeprovider.   when('/casters', {     templateurl: '../templates/casters/index.html',         controller: 'casterindexctrl'       }).     otherwise({       templateurl: '../templates/home.html',       controller: 'homectrl'     })  ],  ['$compileprovider', ($compileprovider) -> $compileprovider.urlsanitizationwhitelist(/^\s*(https?|steam|mailto|file):/); ])  <tr ng-repeat="caster in casters">     <td><a ng-href="steam://friends/add/{{caster.steam_id}}"><button type="button" class="butn btn-link">add</button></a></td>     <td>{{caster.name}}</td>     <td><a href="http://twitch.tv/{{caster.twitch}}" target="_blank">{{caster.twitch}}</a></td>     <td>column content</td>   </tr> 

you need href sanitization:

$compileprovider.ahrefsanitizationwhitelist(/^\s*(https?|ftp|mailto|tel|file|steam):/); 

this appending steam regex in santizeuri.js

i believe urlsanitizationwhitelist changed in version 1.2? remember having similar issue getting work based on blogs , dug around in source until found answer. @ time had same problem, angular's docs down, looks they have been updated information.

also, sure you're including ngsanitize both dependency , referencing angular-sanitize.js file.

edit: oh missed you're on 1.1.5. i'll see if can track down in revision.

edit 2: created a plunk compile override allow steam, , works launch steam.

then, noticed you're passing 2 config functions .config (i think, don't read coffeescript).

try this:

@app.config(['$routeprovider','$compileprovider', ($routeprovider, $compileprovider) ->    $routeprovider.   when('/casters', {     templateurl: '../templates/casters/index.html',         controller: 'casterindexctrl'       }).     otherwise({       templateurl: '../templates/home.html',       controller: 'homectrl'     })       $compileprovider.urlsanitizationwhitelist(/^\s*(https?|steam|mailto|file):/); ]) 

http://code.angularjs.org/1.1.5/docs/api/angular.module

the docs angular 1.1.5 pretty terrible. don't explain whole array injector thing. configfn either single function or array of dependencies injected function (last array element).


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -