Skip to content

Instantly share code, notes, and snippets.

Last active Sep 28, 2016
What would you like to do?
AngularJS Text To Speech
<!doctype html>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<link rel="stylesheet" href="//" />
<link rel="stylesheet" href="" />
<div class="container" ng-app="PubNubAngularApp" ng-controller="MySpeechCtrl">
<pre>NOTE: Requires Chrome Desktop or Android Browser</pre>
<h3>MyText to Speech</h3>
<textarea ng-model="theText" rows="10" cols="40"></textarea>
<input type="button" ng-click="sayIt()" value="Say it!" />
angular.module('PubNubAngularApp', ["pubnub.angular.service"])
.controller('MySpeechCtrl', function($rootScope, $scope, Pubnub) {
$scope.theText = "Welcome to the speech enabled world!";
$scope.sayIt = function () {
window.speechSynthesis.speak(new SpeechSynthesisUtterance($scope.theText));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment