mirror of
https://github.com/MinimalBible/MinimalBible
synced 2024-11-04 23:28:19 -05:00
Statically get access to the Angular scope
This commit is contained in:
parent
1911f3128a
commit
799091b6e4
@ -2,7 +2,7 @@
|
||||
<head>
|
||||
<script type="text/javascript" src="file:///android_asset/dist/book-bundle.js"></script>
|
||||
</head>
|
||||
<body ng-controller="BookCtrl">
|
||||
<body ng-controller="BookCtrl" id="bookController">
|
||||
<div ng-repeat="verse in verses">
|
||||
{{ verse.text }}
|
||||
</div>
|
||||
|
11
app/src/main/assets/dist/book-bundle.js
vendored
11
app/src/main/assets/dist/book-bundle.js
vendored
File diff suppressed because one or more lines are too long
@ -1,3 +1,4 @@
|
||||
require 'jquery' # For using selectors to access scope
|
||||
require 'angular'
|
||||
|
||||
app = angular.module('bookApp', [])
|
||||
@ -6,4 +7,15 @@ app.controller 'BookCtrl', ['$scope', ($scope) ->
|
||||
$scope.verses = [
|
||||
{'text': 'hello.'}
|
||||
];
|
||||
|
||||
$scope.alert = ->
|
||||
alert "Hello!"
|
||||
]
|
||||
|
||||
###
|
||||
Future reference: Get the controller scope like so:
|
||||
angular.element($("<controller-element>")).scope().<function>
|
||||
|
||||
For example:
|
||||
angular.element($("#bookController")).scope().<function>
|
||||
###
|
||||
|
Loading…
Reference in New Issue
Block a user