Okay, I managed to get done what I wanted to so thought I'd post the 
solution.

By working with directive's scopes I was able to bind the variables and 
make them accessible to my template file.

My directive (note the scope):

appDirectives.directive('bsConfirm', function() {


  return {
    scope: {
      run: '&',
      msg: '@'
    },
    restrict: 'AE',
    templateUrl: '/bsconfirm.ejs'
    // template: confirmModal
  }
});

HTML (in my case ejs) snippet using directive:

<div data-bs-confirm class="modal fade" role="dialog" id="runRecipe" 
     data-msg="Run Recipe?"
     data-run="startProgram(program.select.name, power.power.value)"></div>

And last but not least my template file (bsconfirm.ejs - using boostrap 
modal):

<div class="modal-dialog modal-sm">
  <div class="modal-content">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal">&times;
</button>
      <h4 class="modal-title">Confirm</h4>
    </div>
    <div class="modal-body">
      <p>{{msg}}</p>
    </div>
    <div class="modal-footer">
      <button type="button" class="btn btn-default" data-dismiss="modal">No
</button>
      <button id="confirm" type="button" class="btn btn-default" 
              data-dismiss="modal" ng-click="run()">Yes</button>
    </div>
  </div>
</div>



-- 
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.

Reply via email to