Where to put user defined functions in Angular JS?

One way is to create a service with the functions you want to share across multiple controllers. See this post for more info. After you do so you can inject the service you created into any controller and access the say() function with code something like this: function TestCtrl($scope, myService){ $scope.say = myService.say; } Where … Read more

rails and backbone working together

Before anything else I’d suggest taking a look at thoughtbot’s Backbone.js on Rails book, which is a great starting point, although aimed at an intermediate to advanced audience. I bought this book having already worked with rails but as a total backbone.js beginner and it has served me very well. Beyond that, there are some … Read more

What is the difference between MVI compared to MVC and MVVM

from my experience each architecture pattern of those was invented to solve specific problem that the previous one ignored or wasn’t observed yet. MVC – Model View Controller in UI applications the responsibilty of rendering the data to the screen, or the business logic and bind those together at first wasn’t clear. so MVC came … Read more

What is use of tagName, id, and className properties in Backbone View? While we can access dom element with el

Those properties are used if your view has to create its own element, that is, if it doesn’t have a el attribute when instantiated (various reasons, I can go further in the matter). So you’ll have a new element with the id id, classes className and attributes attributes. You can find the relevant piece of … Read more

JQUERY ajax passing value from MVC View to Controller

Try using the data option of the $.ajax function. More info here. $(‘#btnSaveComments’).click(function () { var comments = $(‘#txtComments’).val(); var selectedId = $(‘#hdnSelectedId’).val(); $.ajax({ url: ‘<%: Url.Action(“SaveComments”)%>’, data: { ‘id’ : selectedId, ‘comments’ : comments }, type: “post”, cache: false, success: function (savingStatus) { $(“#hdnOrigComments”).val($(‘#txtComments’).val()); $(‘#lblCommentsNotification’).text(savingStatus); }, error: function (xhr, ajaxOptions, thrownError) { $(‘#lblCommentsNotification’).text(“Error encountered … Read more