javascript - How to pass routeparams value in model window angularjs? -
in project trying implement modal window edit screen. have listed screen users need select 1 row list , click modify button. need open edit screen in modal window. if call normal screen using this:
$location.path(url) (i.e) url -- > page1/:id --> page1/3
which working fine. it's redirecting corresponding page data.
but in modal window call this:
exdialog.openprime({ scope: $scope, template: urlappbase+templateurl, controller: controllername, width: '1120px', animation: false, graybackground: false });
how send params value controller?
or
how open modal window based on url?
in stateparams
.state('users', { url:'/users/:userid', .... })
if url = '/#/users/2', in controller follows
var usrid = $stateparams.userid;
in routeparams,
.when('/users/:userid', { .... })
if url = '/#/users/2', in controller follows
var usrid = $routeparams.userid
now open dialog.. based on url... pass paramvalues using resolve in dialog..
$scope.opendialog = function() { var modalinstance = $modal.open({ templateurl: 'someviews.html' , controller: modalinstancectrl, scope : $scope, windowclass:'center-modal', resolve:{ someval : function(){ var urlparamval = $routeparams.userid; return urlparamval ; } } }); };
access value in template html {{someval}}
Comments
Post a Comment