angularjs - How to pass data to an angular-foundation modal $scope? -


I am using angular foundations and especially modal, how do I data a model when using a controller I'm confused about passing, I want to assume an array and want to update the model to show a specific user information, ex: $ scope.updateUserInfo = $ scope.user [index], the only problem is how The model has to pass data.

  myApp.controller ('user', function ($ radius, $ location, $ http, $ modal, msg) {$ http.get ('api / v1 / users') .success (Function (data, position) {$ scope.user = data;}) panic (function (data, position) {$ location.path ('/ login');}); $ scope.showWrite = function () { $ Scope.write = true;} $ scope.closeWrite = function () {$ scope.write = false; $ scope.newUser = '';} $ scope.save = function () {$ http.post ('api / V1 / users / store ', $ scope.newUser) .success (function (data, position) {$ scope.user.unshift ({id: data, first_name: $ scope.newUser.first_name, last_name: $ scope.newUser last_name , Email: $ scope.newUser.email, role: $ scope.newUser.role}) $ $ scope.write = false; $ scope.newUser = '';}). Quision (data, status) {warning ('failed');})}} $ scope.confirmDelete = function (index, id) {msg.confirmDelete (). (Function (value) {$ scope.text = msg.getText (); $ Http.get ('API / V1 / user / nast /' id) .vivet (function (data, status) {$ scope.user splice (index, 1);}). Panic (function (data, position) {A larre ('error: operation failed');}); }); } $ Scope.showUserInfo = function {} $ scope.userUpdate = function () {} $ scope.showUserUpdate = function (index) {$ modal.open ({templateUrl: 'partial / message / update' html, controller: 'the user'}); }   

});

You need to update your $ model function in this way to $ $ mode: < Pre> $ scope.showUserUpdate = function (popUpData) {var modalInstance = $ modal.open ({templateUrl: 'Partial / Message / Update ($ scope = angular.extend ($ scope, popUpData);}], [ Resolve: {}}); return system};

Popupdata is the data that you want to send to your model. The popup data is then merged with the current scope of that controller. Now you can access the popup data keys in your HTML. Remember that we are returning the model instance in this function so that you can manually stop the popup using this effect.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -