Skip to content

Commit

Permalink
chore(docs): re-skin main documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery committed May 4, 2012
1 parent d015945 commit 8e26750
Show file tree
Hide file tree
Showing 82 changed files with 2,753 additions and 2,724 deletions.
15 changes: 9 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ task :compile => [:init, :compile_scenario, :compile_jstd_scenario_adapter] do

concat_module('resource', ['src/ngResource/resource.js'])
concat_module('cookies', ['src/ngCookies/cookies.js'])
concat_module('bootstrap', ['src/bootstrap/bootstrap.js'])
concat_module('bootstrap-prettify', ['src/bootstrap/bootstrap-prettify.js',
'src/bootstrap/google-prettify/prettify.js'],
gen_css('src/bootstrap/google-prettify/prettify.css', true))


FileUtils.cp 'src/ngMock/angular-mocks.js', path_to('angular-mocks.js')
Expand All @@ -99,6 +103,8 @@ task :compile => [:init, :compile_scenario, :compile_jstd_scenario_adapter] do
closure_compile('angular-loader.js')
closure_compile('angular-resource.js')
closure_compile('angular-sanitize.js')
closure_compile('angular-bootstrap.js')
closure_compile('angular-bootstrap-prettify.js')

end

Expand Down Expand Up @@ -159,10 +165,7 @@ task :package => [:clean, :compile, :docs] do
"#{pkg_dir}/docs-#{NG_VERSION.full}/index-jq-debug.html"
].each do |src|
rewrite_file(src) do |content|
content.sub!('angular.js', "angular-#{NG_VERSION.full}.js").
sub!('angular-resource.js', "angular-resource-#{NG_VERSION.full}.js").
sub!('angular-cookies.js', "angular-cookies-#{NG_VERSION.full}.js").
sub!('angular-sanitize.js', "angular-sanitize-#{NG_VERSION.full}.js")
content.gsub!(/'angular(.*)\.js/, '\'angular\1-' + NG_VERSION.full + '.js')
end
end

Expand Down Expand Up @@ -305,8 +308,8 @@ def concat_file(filename, deps, footer='')
end


def concat_module(name, files)
concat_file('angular-' + name + '.js', ['src/module.prefix'] + files + ['src/module.suffix'])
def concat_module(name, files, footer='')
concat_file('angular-' + name + '.js', ['src/module.prefix'] + files + ['src/module.suffix'], footer)
end


Expand Down
7 changes: 5 additions & 2 deletions angularFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ angularFiles = {
'src/ng/directive/ngView.js',
'src/ng/directive/script.js',
'src/ng/directive/select.js',
'src/ng/directive/style.js'
'src/ng/directive/style.js',
],

'angularSrcModules': [
Expand All @@ -68,7 +68,9 @@ angularFiles = {
'src/ngSanitize/sanitize.js',
'src/ngSanitize/directive/ngBindHtml.js',
'src/ngSanitize/filter/linky.js',
'src/ngMock/angular-mocks.js'
'src/ngMock/angular-mocks.js',

'src/bootstrap/bootstrap.js'
],

'angularScenario': [
Expand Down Expand Up @@ -96,6 +98,7 @@ angularFiles = {
'test/ngScenario/jstd-scenario-adapter/*.js',
'test/*.js',
'test/auto/*.js',
'test/bootstrap/*.js',
'test/ng/*.js',
'test/ng/directive/*.js',
'test/ng/filter/*.js',
Expand Down
62 changes: 3 additions & 59 deletions docs/content/api/index.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,6 @@
@name API Reference
@description

## Angular Compiler API

* {@link angular.module.ng.$compileProvider.directive Directives} - Angular DOM element attributes
* {@link angular.module.ng.$filter Filters} - Angular output filters
* {@link angular.module.ng.$compile $compile} - Template compiler

## Angular Scope API

* {@link angular.module.ng.$rootScope.Scope Scope Object} - Angular scope object


## Angular Services & Dependency Injection API

* {@link angular.module.ng Angular Services}
* {@link angular.injector angular.injector() }


## Angular Testing API

* {@link angular.module.ngMock Testing Mocks API} - Mock objects for testing
* {@link guide/dev_guide.e2e-testing Angular Scenario Runner} - Automated scenario testing
documentation


## Angular Utility Functions

### HTML & DOM Manipulation

* {@link angular.element angular.element()}

### Misc

* {@link angular.bind angular.bind() }
* {@link angular.extend angular.extend() }
* {@link angular.forEach angular.forEach() }
* {@link angular.identity angular.identity() }
* {@link angular.noop angular.noop() }


## Type Identification

* {@link angular.isArray angular.isArray() }
* {@link angular.isDate angular.isDate() }
* {@link angular.isDefined angular.isDefined() }
* {@link angular.isFunction angular.isFunction() }
* {@link angular.isNumber angular.isNumber() }
* {@link angular.isObject angular.isObject() }
* {@link angular.isString angular.isString() }
* {@link angular.isUndefined angular.isUndefined() }

## Strings

* {@link angular.lowercase angular.lowercase() }
* {@link angular.uppercase angular.uppercase() }

### JSON

* {@link angular.fromJson angular.fromJson() }
* {@link angular.toJson angular.toJson() }
Use the API Refference documentation when you need more information about a specific feature. Check out
{@link guide/ Developer Guide} for AngularJS concepts. If you are new to AngularJS we recomend the
{@link tutorial/ Tutorial}.
151 changes: 95 additions & 56 deletions docs/content/cookbook/deeplinking.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,72 +30,111 @@ In this example we have a simple app which consist of two screens:
* Welcome: url `welcome` Show the user contact information.
* Settings: url `settings` Show an edit screen for user contact information.


The two partials are defined in the following URLs:

* <a href="examples/settings.html" target="_self">./examples/settings.html</a>
* <a href="examples/welcome.html" target="_self">./examples/welcome.html</a>

<doc:example module="deepLinking">
<doc:source jsfiddle="false">
<script>
angular.module('deepLinking', ['ngSanitize'])
.config(function($routeProvider) {
$routeProvider.when("/welcome", {template:'./examples/welcome.html', controller:WelcomeCntl});
$routeProvider.when("/settings", {template:'./examples/settings.html', controller:SettingsCntl});
});

AppCntl.$inject = ['$scope', '$route']
function AppCntl($scope, $route) {
// initialize the model to something useful
$scope.person = {
name:'anonymous',
contacts:[{type:'email', url:'[email protected]'}]
};
}

function WelcomeCntl($scope) {
$scope.greet = function() {
alert("Hello " + $scope.person.name);
};
}

function SettingsCntl($scope, $location) {
$scope.cancel = function() {
$scope.form = angular.copy($scope.person);
};

$scope.save = function() {
angular.copy($scope.form, $scope.person);
$location.path('/welcome');
};

$scope.cancel();
}
</script>
<example module="deepLinking" deps="angular-sanitize.js">
<file name="script.js">
angular.module('deepLinking', ['ngSanitize'])
.config(function($routeProvider) {
$routeProvider.
when("/welcome", {template:'welcome.html', controller:WelcomeCntl}).
when("/settings", {template:'settings.html', controller:SettingsCntl});
});

AppCntl.$inject = ['$scope', '$route']
function AppCntl($scope, $route) {
$scope.$route = $route;

// initialize the model to something useful
$scope.person = {
name:'anonymous',
contacts:[{type:'email', url:'[email protected]'}]
};
}

function WelcomeCntl($scope) {
$scope.greet = function() {
alert("Hello " + $scope.person.name);
};
}

function SettingsCntl($scope, $location) {
$scope.cancel = function() {
$scope.form = angular.copy($scope.person);
};

$scope.save = function() {
angular.copy($scope.form, $scope.person);
$location.path('/welcome');
};

$scope.cancel();
}
</file>
<file name="style.css">
[ng-view] {
border: 1px solid blue;
margin: 0;
padding:1em;
}

.partial-info {
background-color: blue;
color: white;
padding: 3px;
}
</file>
<file name="index.html">
<div ng-controller="AppCntl">
<h1>Your App Chrome</h1>
[ <a href="welcome">Welcome</a> | <a href="settings">Settings</a> ]
<hr/>
<span style="background-color: blue; color: white; padding: 3px;">
<span class="partial-info">
Partial: {{$route.current.template}}
</span>
<ng:view style="border: 1px solid blue; margin: 0; display:block; padding:1em;"></ng:view>
<div ng-view></div>
<small>Your app footer </small>
</div>
</doc:source>
<doc:scenario>
</file>
<file name="settings.html">
<label>Name:</label>
<input type="text" ng:model="form.name" required>

<div ng:repeat="contact in form.contacts">
<select ng:model="contact.type">
<option>url</option>
<option>email</option>
<option>phone</option>
</select>
<input type="text" ng:model="contact.url">
[ <a href="" ng:click="form.contacts.$remove(contact)">X</a> ]
</div>
<div>
[ <a href="" ng:click="form.contacts.$add()">add</a> ]
</div>

<button ng:click="cancel()">Cancel</button>
<button ng:click="save()">Save</button>
</file>
<file name="welcome.html">
Hello {{person.name}},
<div>
Your contact information:
<div ng:repeat="contact in person.contacts">{{contact.type}}:
<span ng-bind-html="contact.url|linky"></span>
</div>
</div>
</file>
<file name="scenario.js">
it('should navigate to URL', function() {
element('a:contains(Welcome)').click();
expect(element('ng\\:view').text()).toMatch(/Hello anonymous/);
element('a:contains(Settings)').click();
input('form.name').enter('yourname');
element(':button:contains(Save)').click();
element('a:contains(Welcome)').click();
expect(element('ng\\:view').text()).toMatch(/Hello yourname/);
element('a:contains(Welcome)').click();
expect(element('[ng-view]').text()).toMatch(/Hello anonymous/);
element('a:contains(Settings)').click();
input('form.name').enter('yourname');
element(':button:contains(Save)').click();
element('a:contains(Welcome)').click();
expect(element('[ng-view]').text()).toMatch(/Hello yourname/);
});
</doc:scenario>
</doc:example>
</file>
</example>



Expand Down
2 changes: 1 addition & 1 deletion docs/content/guide/dev_guide.bootstrap.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Compatibility} doc.

## Creating Your Own Namespaces

When you are ready to define your own {@link api/angular.module.ng.$compileProvider.directive
When you are ready to define your own {@link guide/directive
directive}, you may chose to create your own namespace in addition to specifying the Angular
namespace. You use your own namespace to form the fully qualified name for directives that you
create.
Expand Down
4 changes: 2 additions & 2 deletions docs/content/guide/dev_guide.compiler.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@description

The core of Angular is its HTML compiler. The compiler processes Angular
{@link api/angular.module.ng.$compileProvider.directive directives} allowing them to transform a
{@link guide/directive directives} allowing them to transform a
static HTML page into a dynamic web application.

The default HTML transformations that the Angular compiler provides are useful for building generic
Expand All @@ -21,4 +21,4 @@ All compilation takes place in the web browser; no server is involved.
## Related API

* {@link api/angular.module.ng.$compile Angular Compiler API}
* {@link api/angular.module.ng.$compileProvider.directive Directives API}
* {@link guide/directive Directives API}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@description

The {@link api/angular.module.ng.$compile compiler} is responsible for applying
{@link api/angular.module.ng.$compileProvider.directive directives} to the HTML. The directives
{@link guide/directive directives} to the HTML. The directives
extend the behavior of HTML elements and can effect the DOM structure, presentation, and behavior.
This allows Angular to teach the browser new tricks.

Expand All @@ -21,7 +21,7 @@ Since directives allow attachment of behavior to the HTML, the angular philosoph
HTML as Domain Specific Language (DSL) when building an application. For example it may be useful
to declare `TabPanel` directive, or `KeyboardShortcut` directive when for an application.

For details on how directives are created see {@link api/angular.module.ng.$compileProvider.directive
For details on how directives are created see {@link guide/directive
directives}

## Related Topics
Expand Down
12 changes: 6 additions & 6 deletions docs/content/guide/dev_guide.forms.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ In addition it provides {@link api/angular.module.ng.$compileProvider.directive.
<pre>master = {{master | json}}</pre>
</div>

<script type="text/javascript">
<script>
function Controller($scope) {
$scope.master= {};

Expand Down Expand Up @@ -91,7 +91,7 @@ This ensures that the user is not distracted with an error until after interacti
}
</style>

<script type="text/javascript">
<script>
function Controller($scope) {
$scope.master= {};

Expand Down Expand Up @@ -152,7 +152,7 @@ This allows us to extend the above example with these features:
</form>
</div>

<script type="text/javascript">
<script>
function Controller($scope) {
$scope.master= {};

Expand Down Expand Up @@ -227,7 +227,7 @@ In the following example we create two directives.
</form>
</div>

<script type="text/javascript">
<script>
var app = angular.module('form-example1', []);

var INTEGER_REGEXP = /^\-?\d*$/;
Expand Down Expand Up @@ -281,13 +281,13 @@ In order for custom control to work with `ngModel` and to achieve two-way data-b
- implement `render` method, which is responsible for rendering the data after it passed the {@link api/angular.module.ng.$compileProvider.directive.ngModel.NgModelController#$formatters NgModelController#$formatters},
- call `$setViewValue` method, whenever the user interacts with the control and model needs to be updated. This is usually done inside a DOM Event listener.

See {@link api/angular.module.ng.$compileProvider.directive $compileProvider.directive} for more info.
See {@link guide/directive $compileProvider.directive} for more info.

The following example shows how to add two-way data-binding to contentEditable elements.

<doc:example module="form-example2">
<doc:source>
<script type="text/javascript">
<script>
angular.module('form-example2', []).directive('contenteditable', function() {
return {
require: 'ngModel',
Expand Down
Loading

0 comments on commit 8e26750

Please sign in to comment.