dimanche 12 avril 2015

unable to pass data between the views in angularjs through routing


Vote count:

0




In my angularjs app, I am trying to pass the data from one cshtml view to another view through routing but in details.cshtml, I don't see the data coming into it though I can see the change in URL


Index.cshtml (View1)



<a href="/#/Details/{{ cid }}" ng-click="SendToCartPage(cartprd)">{{addprodtocart}} </a>


Controller.js



app.controller('CartController', function ($scope) {
$scope.SendToCartPage = function(cartprd)
{
var len = cartprd.length - 1;
$scope.cid = cartprd[len];
}


});


Details.cshtml ( I don't see the data coming into the span below)



<div ng-controller="CartController">
<span ng-model="cid">{{cid}}</span>
</div>


Myrouting



var app = angular.module("productmodule", ["ngRoute"]);
app.config(['$routeProvider',
function ($routeProvider) {
$routeProvider.

when('/Details/:cid', {
templateUrl: '/Product/Details',
controller: 'CartController'
});
}]);


asked 1 min ago







unable to pass data between the views in angularjs through routing

Aucun commentaire:

Enregistrer un commentaire