How to set an iframe src attribute from a variable in AngularJS

后端 未结 6 1200
旧时难觅i
旧时难觅i 2020-11-22 17:24

I\'m trying to set the src attribute of an iframe from a variable and I can\'t get it to work...

The markup:

6条回答
  •  时光说笑
    2020-11-22 18:08

    Please remove call to trustSrc function and try again like this . {{trustSrc(currentProject.url)}} to {{currentProject.url}}. Check this link http://plnkr.co/edit/caqS1jE9fpmMn5NofUve?p=preview


    But according to the Angular Js 1.2 Documentation, you should write a function for getting src url. Have a look on the following code.

    Before:

    Javascript

    scope.baseUrl = 'page';
    scope.a = 1;
    scope.b = 2;
    

    Html