What if instead of trying to load the ng-src in the partial with the {{}}
notation if you did it in your controller.
Controller code:
angular.forEach(locations, function(location) {
location.scriptUrl = "https://podio.com/webforms/" + location.
podio_folder_id + "/" + loc.podio_js_id + ".js
<https://www.google.com/url?q=https%3A%2F%2Fpodio.com%2Fwebforms%2F%257B%257Bloc.podio_folder_id%257D%257D%2F%257B%257Bloc.podio_js_id%257D%257D.js&sa=D&sntz=1&usg=AFQjCNFUd-_OJM8bWiK_tVdwY2UI_Xn4vg>
";
}
then in your partial:
<script ng-src="{{loc.scriptUrl}}
<https://www.google.com/url?q=https%3A%2F%2Fpodio.com%2Fwebforms%2F%257B%257Bloc.podio_folder_id%257D%257D%2F%257B%257Bloc.podio_js_id%257D%257D.js&sa=D&sntz=1&usg=AFQjCNFUd-_OJM8bWiK_tVdwY2UI_Xn4vg>
"></script>
Usually I think it's better to do computations and function calls in the
controller and pre-pack the values into array elements that I use in
ng-repeat rather than try and figure them out in the partial's compilation.
On Tuesday, August 26, 2014 10:16:36 PM UTC-4, [email protected]
wrote:
>
> I am trying to convert a hard code list of podio web forms inside of divs
> to a data driven list. I'm using ng-repeat, ng-src and {{ markup }} inside
> of javascript (which probably won't work). The select statement works
> perfectly. the ng-src and javascript fail miserably. Any help / knowledge
> about how this can be done is greatly appreciated
>
> a single hard coded form would look like this
>
> <div id="baok" style="display: none">
> <script src="https://podio.com/webforms/7431510/565280.js"></script>
> <script type="text/javascript">
> _podioWebForm.render("565280")
> </script>
> </div>
>
> The complete angular code with multiple forms (sans actual data) looks
> like this
>
> <div ng-app="slimgeneration_app" ng-controller="slimgeneration_controller">
> <label><strong>Choose a location:<strong></label><br />
> <select class="form-control" ng-model="ui.selected_location" ng-options="
> location.name group by location.state for location in locations">
> </select>
> <div ng-repeat="loc in locations" >
> <div ng-if="loc.podio_folder_id != 0" ng-show="ui.selected_location.id ==
> 'loc.id'" >
> <script ng-src="
> https://podio.com/webforms/{{loc.podio_folder_id}}/{{loc.podio_js_id}}.js
> "></script>
> <script type="text/javascript">
> _podioWebForm.render("{{loc.podio_js_id}}");
> </script>
> </div>
> </div>
> </div>
>
> <script type="text/javascript">
> var app = angular.module('slimgeneration_app', ['ng']);
> function slimgeneration_controller($scope)
> {
> $scope.locations =
> [
> // location information goes here
> ];
> $scope.ui =
> {
> selected_location: $scope.locations[$scope.locations.length - 2]
> };
> }
> slimgeneration_controller['$inject'] = ['$scope'];
> </script>
>
> Thanks in advance,
> - David
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.