JSFiddle - React, Tailwind, and code Playground

by chrisguzman

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script>
<script src="https://cdn.firebase.com/js/client/1.0.17/firebase.js"></script>
<script src="https://cdn.firebase.com/libs/angularfire/0.7.1/angularfire.min.js"></script>
<section ng-app="sampleApp" ng-controller="ProfileCtrl">
         <h3>Edit {{profile.$id}}</h3>
        <form ng-submit="profile.$save()">
            <label>Name:</label>
            <input type="text" ng-model="profile.name" />
            <label>Email:</label>
            <input type="text" ng-model="profile.email" />
            <button type="submit">Save Changes</button>
        </form>
    
</section>

JavaScript

var app = angular.module("sampleApp", ["firebase"]);

app.factory("Profile", ["$firebase", function ($firebase) {
    return function (username) {
        var ref = new Firebase("https://helloworldtest.firebaseio.com/profiles/").child(username);
        return $firebase(ref).$asObject();
    }
}]);

app.controller("ProfileCtrl", ["$scope", "Profile",
function ($scope, Profile) {
    $scope.profile = Profile("physicsmarie");
}]);