JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.15/angular-ui-router.min.js"></script>
<div ui-view></div>
JavaScript
var app = angular.module('MyApp', ['ui.router']);
app.config(function($stateProvider, $urlRouterProvider, $locationProvider) {
$urlRouterProvider.otherwise('/home');
$stateProvider
.state('home', {
url: '/home',
template: '<input type="file" onchange="angular.element(this).scope().selectFile(this.files[0])" />',
controller: function($scope, $state) {
$scope.selectFile = function(file) {
$state.go('form', {'file': file});
};
}
})
.state('form', {
url: '/form',
template: '<h1>Filename: {{filename}}</h1>',
params: {'file': null},
controller: function($scope, $state, $stateParams) {
if ($stateParams.file == null) {
$state.go('home');
return;
}
$scope.filename = $stateParams.file.name;
}
});
});