Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Ryan Hellerud
Ryan Hellerud
3,635 Points

using angular with ngDialog for pop up .

Guys I'm new to angular and trying to figure out how to implement a module called ngDialog so that I can have a pop up appear with angular data ect. Right now, I have my controller:

var oflApp = angular.module('oflApp', ['ngDialog']);
oflApp.controller('oflClassCtrl', function ($scope,ngDialog) {
$scope.classes = [
{"class": "ENGLISH I: INTRO TO LITERATURE AND COMPOSITION Sem 2", "href": "../courses/english.php#p1"}, ect
}];
$scope.clickToOpen = function(index){
       $scope.selectedClass= $scope.classes[index];
       ngDialog.open({template: '../inc/popUp.html'});
    };
});

and html:

<table ng-controller="oflClassCtrl">
ā€¦
<tr ng-repeat = "selectedClass in classes | filter:searchTxt">
        <td><a  ng-click="clickToOpen($index)">{{selectedClass.class}}</a></td>

of course i've added the scripts underneath my angular scripts but is there anything else i need for this to work? I'm not sure what's going on but the pop will not show up on click so im sure something is wrong. What am I doing wrong? Thanks friends.

here is the link to the docs:

https://github.com/likeastore/ngDialog#api