Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<html ng-app="flapperNews">
<head>
    <script src="https://code.jquery.com/jquery.min.js"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.3.2/angular-ui-router.js"></script>
    <script type="text/ng-template" id="horizontal.tpl">
        {{one}}, {{two}}
    </script>
    <script type="text/ng-template" id="vertical.tpl">
        {{one}}<br>{{two}}
    </script>
    <script>
    var app = angular.module('flapperNews', ['ui.router']);
    app.config(['$stateProvider', function ($stateProvider) {
        $stateProvider
            .state('entry', {
                url: '/',
                templateUrl: "vertical.tpl"
            })
    }]);
    app.controller('MainCtrl', ['$scope', '$state', function ($scope, $state) {
        $scope.one = "one";
        $scope.two = "two";
        $scope.layouts = ["horizontal", "vertical"];
        $scope.$watch('layout', function () {
            $state.go('entry'); // need to amend this such that changing "layout" leads to different template
        })
    }])
    </script>
</head>
<body ng-controller="MainCtrl">
    <select ng-model="layout" ng-options="x for x in layouts"></select>
    <br><br>
    <ui-view></ui-view>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
chengtiepro
0viewers