JSFiddle - React, Tailwind, and code Playground

by fergal_doyle

HTML

<div class="nav">
    <a href="#/one">One</a><a href="#/two">Two</a>
</div>
<div ng-app="app" id="ng-app">
    <div ng-view=ng-view></div>
</div>

CSS

.nav a {
    display: inline-block;
    padding: 5px;
    border: 1px solid #ccc;
    margin-right: 8px;
    text-decoration: none;
}

[ng-app] {
    padding: 5px;    
}

JavaScript

var app = angular.module('app', []);

app.config(function ($routeProvider) {
    $routeProvider.when('/one', {
        template: 'Template {{template}}<br>Enter some text: <input type="text" /> then click "Two"',
        controller: 'one'
    })
        .when('/two', {
        template: 'Template {{template}}<br>Click back to view "One" to see changes undone',
        controller: 'two'
    })
        .otherwise({
        redirectTo: '/one'
    });
});

app.controller("one", function ($scope) {
    $scope.template = "One";
});

app.controller("two", function ($scope) {
    $scope.template = "Two";
});