javascript - How to make modal window open dynamic content and change url? -
i make modal window open different routing website http://architizer.com/projects/rauchkuchlhaus-auf-der-seewiese-am-schliersee-1/
the flow is:
- create route state modal window
- put modal opening logic inside
onenter
property (will running when route changed current state). - finally items(which should open new modals) should have references change route needed parameters
ui-sref="home({foo: 'fooval1'})"
.
you can find answer in common questions ui-router modal
$stateprovider.state("items.add", { url: "/add", onenter: ['$stateparams', '$state', '$modal', '$resource', function($stateparams, $state, $modal, $resource) { $modal.open({ templateurl: "items/add", resolve: { item: function() { new item(123).get(); } }, controller: ['$scope', 'item', function($scope, item) { $scope.dismiss = function() { $scope.$dismiss(); }; $scope.save = function() { item.update().then(function() { $scope.$close(true); }); }; }] }).result.finally(function() { $state.go('^'); }); }] });
Comments
Post a Comment