Here's my code for exactly this:
http://codepad.org/6kXZApxD
I use it like this
<span ng-modal-url="'/template_page_url_to_open.html'">Link</span>
Your template page can be wrapped in a controller and it should work as you'd expect (even inheriting from the scope where the link was)
Code also includes this confirm modal..
<button ng-confirm="'Do you really want to delete this?'" ng-on-confirm="Delete()" ng-title="'Confirm Deletion'" ng-text-confirm="'Yes - please delete this'">Delete</button>
You can open a modal from code too..
$bsModal.Get( strURL, options, $scope );
Hope this helps, I don't really know how `compliant` my code is - but it works for me.
garry
On Monday, 25 June 2012 05:07:39 UTC+1, Hilaal Agil wrote:i've been trying to load data inside a modal window using angular.js but i am not sure how to do that. i need the url also to change when the link is clicked and the data to load inside a modal window instead of loading a new page.
i have tried using the jQuery Facebox plugin but it doesnt seem to work, i am also using the twitter bootstrap modal component.
can anybody help?
below is my code:
<div class="subnav span12" id="post-main-container" ng-controller="PostsController">
<div class="btn-group pull-left span5" id="sort-nav">
<a class="btn active">Popular</a>
<a class="btn">Recent</a>
<a class="btn">Favorite</a>
</div>
<div class="btn-group pull-right " id="view-nav">
<a class="btn" id="2col"><i class="icon-th-large"></i></a>
<a class="btn active" id="4col"><i class="icon-th"></i></a>
<a class="btn" id="6col"><i class="icon-th-list"></i></a>
</div>
<div class="btn-group pull-right">
<a id="reload" class="btn"><i class="icon-refresh"></i></a>
<a class="btn"><i class="icon-random"></i></a>
</div>
<div class="row-fluid span12" id="img-container">
<ul class="unstyled" id="image-container">
<li class="post-container box2" ng-repeat="post in posts">
<div class="post-btns" style="display:none;">
<a class="btn btn-mini" href="#">Share</a>
<a class="btn btn-mini" href="#">Add</a>
</div>
<a href="#/posts/{{post.id}}"><img ng-src="{{post.image}}"></a>
<p class="post-snippet" style="display:none;">{{post.description}}</p>
</li>
</ul>
</div>
</div>i want to load the "#/posts/{{post.id}}" in a modal window.