03.12.2015 Views

laravel4cookbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

E-Commerce 255<br />

.<br />

This was extracted from app/views/index.blade.php.<br />

1 <br />

.<br />

This was extracted from app/views/index.blade.php.<br />

1 <br />

.<br />

This was extracted from app/views/index.blade.php.<br />

.<br />

This script should be placed just before the tag.<br />

In addition to these modifications, we should also create the shared.js file:<br />

1 var app = angular.module("app", ["ngCookies"]);<br />

2<br />

3 app.controller("main", function($scope) {<br />

4 console.log("main.init");<br />

5<br />

6 this.shared = "hello world";<br />

7<br />

8 $scope.main = this;<br />

9 });<br />

10<br />

11 app.controller("products", function($scope) {<br />

12 console.log("products.init:", $scope.main.shared);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!