Mr Smith Mr Smith - 1 year ago 148
AngularJS Question

Problems with angular-modal-service

I'm trying to use the angular modal service to display a modal with an inline template, but I get an error. What am I missing? I just want to display a simple message in the modal. Here is the fiddle:


<script src=""></script>

<div class="container" ng-app="app" ng-controller="Controller">

<h3>Angular Modal Service</h3>
<a class="btn btn-default" href ng-click="show()">Show a Modal</a>



var app = angular.module('app', ['angularModalService']);

app.controller('Controller', function($scope, ModalService) {

$scope.test="outer scope"
$ = function() {
template: "{{test}}",
controller: function() {
this.test="test scope";
controllerAs : "modal"


enter image description here

Win Win
Answer Source

You want to access test as {{modal.test}} since you have controllerAs syntax.

According to the documentation here, if you use template, you will need to provide raw HTML.

template: "<div>{{modal.test}}</div>",
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download