1
ben gibi sayfanın $routeParams
erişen bir direktif var açısal sahte/yasemin. Direktife $routeParams
no'lu sahte notu nasıl geçeceğimi anlayamıyorum. Geçtim çünkü hiç belli ki çalışmıyor
describe('myList', function() {
var scope, compile, element, compiledDirective;
var mockParams = { 'year': 1996 };
beforeEach(function() {
module('templates', 'MyApp');
inject(function ($compile, $rootScope, $routeParams) {
compile = $compile;
scope = $rootScope.$new();
});
element = angular.element('<my-list></my-list>');
compiledDirective = compile(element)(scope);
scope.$digest();
});
it('should fill in the year', function() {
expect(scope.year).toEqual(mockParams.year);
});
});
yönergesine mockParams
geçti: Bu aldığım şeydir. Bunu yapmanın bir yolu var mı?
Öğeyi oluşturmadan önce '$ routeParams.year = 1996;' yalnızca nasıl kullanılır? –