Reputation: 17
I have this MVC application mix with angular. On Menu click we access this ClientController in server side Mvc
Partial Public Class ClientController
Inherits System.Web.Mvc.Controller
Function ClientPartial(ByVal id As Integer) As System.Web.Mvc.ActionResult
Dim student As ManagedForm(Of mmClientPartial) = utils.GetForm(Of mmClientPartial)(id)
Return PartialView("ClientPartial", student)
End Function
End Class
Then i have this in my view ClientPartial.vbhtml
<div ng-controller="studentController">
{{studentId}}
</div>
My angular controller is
var mainApp = angular.module("mainApp", []); mainApp.controller('studentController', function ($scope) {
$scope.studentId = "From MVC";});
enter code here
The problem is how can i get the StudentId
in my angular controller?
Upvotes: 0
Views: 612
Reputation: 2378
You can use ng-init
<div ng-controller="studentController" ng-init="[email protected]">
{{studentId}}
</div>
Upvotes: 1