This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>File Upload example</title> | |
<link href="/Content/bootstrap.css" rel="stylesheet" /> | |
</head> | |
<body> | |
<form action="api/Upload" method="post"> | |
<div class="form-group"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define(['plugins/http', 'plugins/dialog', 'durandal/app', 'viewmodels/locale', 'knockout'], | |
function (http, dialog, app, locale, ko) { | |
//Note: This module exports an object. | |
//That means that every module that "requires" it will get the same object instance. | |
//If you wish to be able to create multiple instances, instead export a function. | |
//See the "welcome" module for an example of function export. | |
var engineersViewModel = function() { | |
var self = this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* read-only date display with momentjs | |
* use like this: data-bind="moment: dateVar, format: 'YYYY-MM-DD'" | |
* The "format" is optional and will default to "MM/DD/YYYY" | |
*/ | |
ko.bindingHandlers.moment = { | |
update: function (element, valueAccessor, allBindingsAccessor, viewModel) { | |
var val = valueAccessor(); | |
var date = moment(ko.utils.unwrapObservable(val)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Author: Tim Larson @codethug | |
ko.bindingHandlers.beforeUnloadText = { | |
init: function(element, valueAccessor, allBindingsAccessor, viewModel) { | |
if (window.onbeforeunload == null) { | |
window.onbeforeunload = function(){ | |
var value = valueAccessor(); | |
var promptText = ko.utils.unwrapObservable(value); | |
if (typeof promptText == "undefined" || promptText == null) { | |
// Return nothing. This will cause the prompt not to appear | |
} else { |