Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带对象传递的angularjs路由_Angularjs - Fatal编程技术网

带对象传递的angularjs路由

带对象传递的angularjs路由,angularjs,Angularjs,当我从“部门列表”中单击“查看”按钮时,视图模板上未显示数据。我没有使用任何服务。 请帮我找个人 我的源代码如下 我的角js控制器: .when('/Edit/:Id', { templateUrl: baseSiteUrlPath + 'Templates/Hrm_dept/Edit.html', controller: 'DeptCtrl' }) $scope.DeptView = function (Dept) {

当我从“部门列表”中单击“查看”按钮时,视图模板上未显示数据。我没有使用任何服务。 请帮我找个人

我的源代码如下

我的角js控制器:

.when('/Edit/:Id', {

            templateUrl: baseSiteUrlPath + 'Templates/Hrm_dept/Edit.html',
            controller: 'DeptCtrl'
        })

    $scope.DeptView = function (Dept) {
        console.log(Dept);
        $scope.Dept1 = angular.copy(Dept);
        var id = 1;
        var earl = '/Edit/' + id;
        $location.path(earl);
    };
我的列表模板:

ng-click="DeptView(Dept)"
我的视图模板:

ng-model="Dept1.DEPT_NAME"

为此,您的代码应该如下所示

listController.js

在listController.Html中,它应该包含如下链接

detailController.js


如需更多参考资料,请参阅

我需要asp.net mvc angularjs专家扫描您为上述问题创建一个JSFIDLE以便清楚理解。我有3个tepmlate页面1。Create.html.2。List.html 3。Edit.html创建和列表工作正常。当我试图通过单击“编辑”按钮从列表转到编辑模板时,我传递的对象单击“DeptView(Dept)”不显示在编辑或查看模板中。DeptView(Dept)函数存在于同一控制器中。请创建一个小示例,说明您在plnkr中所做的操作。coi已解决此问题。我用了另外一个控制器。谢谢
Bring List From Db and give to listController.Html
<a ng-href="#/edit/{{project.$id}}"><i class="icon-pencil"></i></a>
<a ng-href="#/edit/{{project.$id}}"><i class="icon-pencil"></i></a>
<a ng-href="#/edit/{{project.$id}}"><i class="icon-pencil"></i></a>
.when('/edit/:projectId', {
controller:'detailController',
templateUrl:'detailController.html'
})
.controller('detailController',function($location, $route){

    var projectId = $route.projectId,

    //getDataByIdFromDb
    $http.get('sales/getsalesbyid?id=' + projectId).then(function(response) 
    {
         populate result in html
    });  
});