Tuesday, October 17, 2017

Parent View to Child View Error in AngularJS

I am trying to achieve Parent View A to Child View B with unique ID from SQL.

Bottom below, the is shown well.
However, if I put that in the ui-sref, it is not recognized.

I am trying to perform: Click Edit button, then it goes to edit window.

[HTML]

<a ui-sref="pjt.project_registration.project_edit({id: -'1'})">Edit</a>

[controller.js]

$http.post("../crud/projects_read.php", {
    })
    .then(function(response){
        $scope.projects = response.data;
        $scope.project_data = $scope.projects[$stateParams.id];
        $scope.project_id_real = $scope.project_data.project_id;
    });

[config.js]

.state('pjt.project_registration.project_edit', {
        url: '/step_one/:id',
        templateUrl: 'views/project_registration_steps/step_one.html',
        data: { pageTitle: 'Project Registration form' },
        controller: 'ProjectCtrl'
    })

I have performed like this before and it worked, but now it doesn’t. Can anyone help me with what I am missing? Perhaps, I should NOT use $stateParam? I don’t know.. I am a beginner and came this far, but I am lost.. Please help..!

Thank you for your advice and support in advance!!!

Source: AngularJS



from Angular Questions https://angularquestions.com/2017/10/17/parent-view-to-child-view-error-in-angularjs/
via @lzomedia #developer #freelance #web #lzomedia.com

No comments:

Post a Comment