I cannot put data in an ng model from the point of view of an object in a controller.
VIEW1:
<input type="text" class="user-input" name="profile.firstname" ng-model="profile.firstname" ng-minlength="2" required pattern=".{2,}" placeholder="Eg Anvika" title="Please enter atleast 2 characters">
When I press a button in VIEW2, it launches a function (say, the function 'test').
VIEW2
<input type="submit" ng-click="register.test()" ui-sref="doctorRegister" value="Profile">
CONTROLLER:
var app = angular.module('app'); app.controller('registerController', ['$scope', 'tempDataStorageService', function ($scope, tempDataStorageService) { var register = this; register.doctor = {}; register.test = function () { register.refreshProfile = tempDataStorageService.get(register.doctor.profile);
TempDataStorageService:
var app = angular.module('app'); app.factory('tempDataStorageService', function() { var savedData = {}; function set(data) { savedData = data; } function get() { return savedData; } return { set: set, get: get } });
EDIT: I tried showing a controller declaration if that helps. How can I do this so that when I click the Profile button on VIEW2, it fills VIEW1 with data?
source share