JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://code.angularjs.org/1.0.0rc5/angular-1.0.0rc5.js"></script>
<div ng-app="test">
    Why is the array not being passed correctly? Should update to object instead of string for the typeof check in the scope.$watch call.<br /><br />
    <div ng-controller="MainCtrl">       
                <h1>Status: {{status}}</h1>
        <ruleview />      
    </div>
</div>

CSS

body {
    font-family: 'arial';
}

JavaScript

var app = angular.module('test', []);

app.directive('ruleview', function() {
    return {
        restrict: 'E',
        link: function(scope, element, attrs) {
            scope.$watch('rules', function(newRules) {
                var output = "";
                if (newRules instanceof Array) {
                    output += "array with length of " + newRules.length;
                } else {
                    output += "not an array";
                }
                scope.status = output;
            });            
        }                 
    }
});

function MainCtrl($scope) {
    $scope.rules = [ { key: 'something' } ];
    $scope.status = 'Should change to array';
}