What I am trying to achieve is as follows:
- I am using AngularJS and ASP.NET MVC to build my project.
- I have made a product page where I need the title to be displayed according to the product name.
- In this I have used brackets {{ }} to display the name of the product. Similarly I am trying to use the brackets or ng-model or ng-init or ng-value to be used to display the title usng viewbag.title.
Example:
I am getting the data from .js file
$scope.getdata = function(){
$http.get(urlApi).then(function(response){
$scope.AllRecords = response.data;
});
}
Now on ASP.NET MVC I am trying to achieve the record value inside ViewBag.title like below:
@{
ViewBag.title = {{ AllRecords.Name }};
}
I am unable to get the record in ViewBag.title. Please suggest the idea of achieving this if this way is not possible.
Thanks in Advance.