Q:

Call a JS function within an MVC View

In the CSHTML file below, the three javascript functions are not working. I have tried three different methods that I found, and none work correctly.
My issue is probably misunderstanding the timing of a page load. I have accessed a database in c# in the cshtml file and I want to add all of the data I retrieved to an array in the js file so that it can be applied to the Angularjs Smart-Table addon. I couldn't find any examples of smart-table drawing its data from a database (kinda stupid that they don't have one) so I have been trying to wing it with my limited understanding of ASP.net, Angular.js, MVC6 and JS.
CSHTML File
<body ng-controller="paginationCtrl">
Number of Results: @num_results <br> @error_message <br> @results[1].title

@foreach (Event row in results)
{
    <script type="text/javascript">
        jk();
    </script>

    @Html.Raw("push('" + @row.event_id + "', " + "'" + @row.title + "', " + "'" + @row.datetime + "', " + "'" + @row.place + "', " + "'" + @row.address + "', " + "'" + @row.send_calendar_invites + "', " + "'" + @row.full_description + "', " + "'" + @row.description + "', " + "'" + @row.is_expired + "', " + "'" + @row.rsvp_limit + "', " + "'" + @row.rsvp_cutoff + "');");

    <text>push(@row.event_id, @row.title, @row.datetime, @row.place, @row.address, @row.send_calendar_invites, @row.full_description, @row.description, @row.is_expired, @row.rsvp_limit, @row.rsvp_cutoff);</text>
}

Javascript File
angular.module('myApp', ['smart-table'])
.controller('paginationCtrl', ['$scope', function (scope) {

    scope.itemsByPage = 10;

    scope.rowCollection = [];
    function jk() {
        alert("TEST");
    }
    function createEvent(eid, ttl, dt, plc, addr, sci,
                    fdesc, desc, ie, rl, rc)
    {
        var event_id = eid, title = ttl, datetime = dt, place = plc,    address = addr, send_calendar_invites = sci, full_description = fdesc,  description = plc, is_expired = ie, rsvp_limit = rl, rsvp_cutoff = rc;

        return {
            event_id: event_id,
            title: title,
            datetime: datetime,
            place: place,
            address: address,
            send_calendar_invites: send_calendar_invites,
            full_description: full_description,
            description: description,
            is_expired: is_expired,
            rsvp_limit: rsvp_limit,
            rsvp_cutoff: rsvp_cutoff
        };
    }

    function push(eid, ttl, dt, plc, addr, sci,
                    fdesc, desc, ie, rl, rc) {
        jk();
        scope.rowCollection.push(
            createEvent(eid, ttl, dt, plc, addr, sci,
                    fdesc, desc, ie, rl, rc));
    }

A:

your function jk will only work within the controller since you defined in there.

